Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Neel Shah
NIFTy
Commits
9a6f726b
Commit
9a6f726b
authored
Jun 03, 2021
by
Philipp Arras
Browse files
_eval -> force
parent
c0c11710
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/library/variational_models.py
View file @
9a6f726b
...
...
@@ -33,10 +33,6 @@ from ..minimization.energy_adapter import StochasticEnergyAdapter
from
..utilities
import
myassert
def
_eval
(
op
,
position
):
return
op
(
position
.
extract
(
op
.
domain
))
class
MeanFieldVI
:
def
__init__
(
self
,
initial_position
,
hamiltonian
,
n_samples
,
mirror_samples
,
initial_sig
=
1
,
comm
=
None
,
nanisinf
=
False
):
...
...
@@ -64,15 +60,15 @@ class MeanFieldVI:
@
property
def
mean
(
self
):
return
_eval
(
self
.
_mean
,
self
.
_KL
.
position
)
return
self
.
_mean
.
force
(
self
.
_KL
.
position
)
@
property
def
std
(
self
):
return
_eval
(
self
.
_std
,
self
.
_KL
.
position
)
return
self
.
_std
.
force
(
self
.
_KL
.
position
)
@
property
def
entropy
(
self
):
return
_eval
(
self
.
_entropy
,
self
.
_KL
.
position
)
return
self
.
_entropy
.
force
(
self
.
_KL
.
position
)
def
draw_sample
(
self
):
_
,
op
=
self
.
_generator
.
simplify_for_constant_input
(
...
...
@@ -116,11 +112,11 @@ class FullCovarianceVI:
@
property
def
mean
(
self
):
return
_eval
(
self
.
_mean
,
self
.
_KL
.
position
)
return
self
.
_mean
.
force
(
self
.
_KL
.
position
)
@
property
def
entropy
(
self
):
return
_eval
(
self
.
_entropy
,
self
.
_KL
.
position
)
return
self
.
_entropy
.
force
(
self
.
_KL
.
position
)
def
draw_sample
(
self
):
_
,
op
=
self
.
_generator
.
simplify_for_constant_input
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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