Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
32af4710
Commit
32af4710
authored
May 27, 2020
by
Philipp Arras
Browse files
Trust simplifying magic in KL and EnergyAdapter
parent
f571b794
Pipeline
#75644
failed with stages
in 4 minutes and 3 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty6/minimization/energy_adapter.py
View file @
32af4710
...
...
@@ -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
...
...
nifty6/minimization/metric_gaussian_kl.py
View file @
32af4710
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment