Commit 076151e3 authored by Reimar Leike's avatar Reimar Leike
Browse files

Fixup

parent a7643e6f
Pipeline #74135 passed with stages
in 20 minutes and 38 seconds
......@@ -299,7 +299,10 @@ class StudentTEnergy(EnergyOperator):
res = (((self._theta+1)/2)*(x**2/self._theta).ptw("log1p")).sum()
if not x.want_metric:
return res
met = ScalingOperator(self.domain, (self._theta+1) / (self._theta+3))
if isinstance(self._theta, Field):
met = makeOp((self._theta+1) / (self._theta+3))
else:
met = ScalingOperator(self.domain, (self._theta+1) / (self._theta+3))
return res.add_metric(met)
......
......@@ -74,6 +74,9 @@ def test_studentt(field):
return
energy = ift.StudentTEnergy(domain=field.domain, theta=.5)
ift.extra.check_jacobian_consistency(energy, field, tol=1e-6)
theta = ift.from_random('normal',field.domain).exp()
energy = ift.StudentTEnergy(domain=field.domain, theta=theta)
ift.extra.check_jacobian_consistency(energy, field, tol=1e-6)
def test_hamiltonian_and_KL(field):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment