Commit 32af4710 by Philipp Arras

### Trust simplifying magic in KL and EnergyAdapter

parent f571b794
Pipeline #75644 failed with stages
in 4 minutes and 3 seconds
 ... ... @@ -56,7 +56,7 @@ class EnergyAdapter(Energy): else: self._op4eval = op self._want_metric = want_metric lin = Linearization.make_partial_var(position, constants, want_metric) lin = Linearization.make_var(position, want_metric) tmp = self._op(lin) self._val = tmp.val.val[()] self._grad = tmp.gradient ... ...
 ... ... @@ -167,8 +167,7 @@ class MetricGaussianKL(Energy): dom = makeDomain(dom) cstpos = mean.extract(dom) _, sample_hamiltonian = hamiltonian.simplify_for_constant_input(cstpos) met = sample_hamiltonian(Linearization.make_partial_var( mean, self._point_estimates, True)).metric met = sample_hamiltonian(Linearization.make_var(mean, True)).metric if napprox >= 1: met._approximation = makeOp(approximation2endo(met, napprox)) _local_samples = [] ... ... @@ -181,7 +180,7 @@ class MetricGaussianKL(Energy): if len(_local_samples) != self._hi-self._lo: raise ValueError("# of samples mismatch") self._local_samples = _local_samples self._lin = Linearization.make_partial_var(mean, self._constants) self._lin = Linearization.make_var(mean) v, g = [], [] for s in self._local_samples: tmp = self._ham4eval(self._lin+s) ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!