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
38a1494f
Commit
38a1494f
authored
Mar 28, 2018
by
Martin Reinecke
Browse files
can't reproduce failure locally. Guessing...
parent
fa4aaa8d
Pipeline
#26560
passed with stages
in 5 minutes and 34 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty4/library/noise_energy.py
View file @
38a1494f
...
...
@@ -44,15 +44,23 @@ class NoiseEnergy(Energy):
self
.
_gradient
+=
grad
expmpos
=
exp
(
-
position
)
self
.
_value
*=
1.
/
len
(
self
.
res_sample_list
)
possum
=
position
.
sum
()
s1
=
(
alpha
-
1.
)
*
possum
if
np
.
isscalar
(
alpha
)
\
else
(
alpha
-
1.
).
vdot
(
position
)
s2
=
q
*
expmpos
.
sum
()
if
np
.
isscalar
(
q
)
else
q
.
vdot
(
expmpos
)
self
.
_value
+=
.
5
*
possum
+
s1
+
s2
self
.
_value
*=
1.
/
len
(
res_sample_list
)
#
possum = position.sum()
#
s1 = (alpha-1.)*possum if np.isscalar(alpha) \
#
else (alpha-1.).vdot(position)
#
s2 = q*expmpos.sum() if np.isscalar(q) else q.vdot(expmpos)
#
self._value += .5*possum + s1 + s2
self
.
_gradient
*=
1.
/
len
(
res_sample_list
)
self
.
_gradient
+=
(
alpha
-
0.5
)
-
q
*
expmpos
# self._gradient *= 1./len(res_sample_list)
# self._gradient += (alpha-0.5) - q*expmpos
alpha_field
=
Field
(
position
.
domain
,
val
=
alpha
)
q_field
=
Field
(
position
.
domain
,
val
=
q
)
self
.
_value
+=
.
5
*
self
.
position
.
sum
()
self
.
_value
+=
(
alpha_field
-
1.
).
vdot
(
self
.
position
)
+
\
q_field
.
vdot
(
expmpos
)
self
.
_gradient
*=
1.
/
len
(
self
.
res_sample_list
)
self
.
_gradient
+=
(
alpha_field
-
0.5
)
-
q_field
*
expmpos
self
.
_gradient
.
lock
()
def
at
(
self
,
position
):
...
...
Write
Preview
Markdown
is supported
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