Commit 92b55b1b authored by Philipp Arras's avatar Philipp Arras
Browse files

Omit unneccesary copies

parent a9d564b0
Pipeline #75600 passed with stages
in 13 minutes and 5 seconds
......@@ -167,11 +167,11 @@ class MetricGaussianKL(Energy):
v, g = [], []
for s in self._local_samples:
tmp = self._hamiltonian(self._lin+s)
tv = tmp.val.val_rw()
tv = tmp.val.val
tg = tmp.gradient
if self._mirror_samples:
tmp = self._hamiltonian(self._lin-s)
tv = tv + tmp.val.val_rw()
tv = tv + tmp.val.val
tg = tg + tmp.gradient
v.append(tv)
g.append(tg)
......
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