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
0427c08e
Commit
0427c08e
authored
Jun 11, 2021
by
Philipp Arras
Browse files
Tentative fix but still not working
parent
fdcda8cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/minimization/energy_adapter.py
View file @
0427c08e
...
...
@@ -202,8 +202,8 @@ class StochasticEnergyAdapter(Energy):
raise
ValueError
samdom
[
k
]
=
op
.
domain
[
k
]
samdom
=
MultiDomain
.
make
(
samdom
)
s
seq
=
random
.
spawn_sseq
(
n_samples
)
context
=
op
,
position
,
s
seq
,
comm
,
n_samples
,
mirror_samples
,
samdom
s
eed
=
int
(
random
.
current_rng
().
integers
(
0
,
1000000
)
)
context
=
op
,
position
,
s
eed
,
comm
,
n_samples
,
mirror_samples
,
samdom
noise
=
cls
.
_draw_noise
(
*
context
)
local_ops
=
[
op
.
simplify_for_constant_input
(
nn
)[
1
]
for
nn
in
noise
]
n_samples
=
2
*
n_samples
if
mirror_samples
else
n_samples
...
...
@@ -211,8 +211,10 @@ class StochasticEnergyAdapter(Energy):
n_samples
,
comm
,
nanisinf
,
context
,
_callingfrommake
=
True
)
@
staticmethod
def
_draw_noise
(
op
,
position
,
s
seq
,
comm
,
n_samples
,
mirror_samples
,
sample_domain
):
def
_draw_noise
(
op
,
position
,
s
eed
,
comm
,
n_samples
,
mirror_samples
,
sample_domain
):
from
.kl_energies
import
_get_lo_hi
with
random
.
Context
(
seed
):
sseq
=
random
.
spawn_sseq
(
n_samples
)
noise
=
[]
for
i
in
range
(
*
_get_lo_hi
(
comm
,
n_samples
)):
with
random
.
Context
(
sseq
[
i
]):
...
...
@@ -220,6 +222,7 @@ class StochasticEnergyAdapter(Energy):
noise
.
append
(
rnd
)
if
mirror_samples
:
noise
.
append
(
-
rnd
)
return
noise
def
samples
(
self
):
...
...
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