Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
77d54592
Commit
77d54592
authored
Jan 09, 2019
by
Philipp Arras
Browse files
Fixups
parent
96bdce1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/test_energy_gradients.py
View file @
77d54592
...
...
@@ -78,7 +78,7 @@ def test_hamiltonian_and_KL(field):
def
test_bernoulli
(
field
):
field
=
field
.
positive_tanh
()
field
=
field
.
sigmoid
()
space
=
field
.
domain
d
=
np
.
random
.
binomial
(
1
,
0.1
,
size
=
space
.
shape
)
d
=
ift
.
Field
.
from_global_data
(
space
,
d
)
...
...
test/test_model_gradients.py
View file @
77d54592
...
...
@@ -74,7 +74,7 @@ def testBinary(type1, type2, space, seed):
model
=
ift
.
ScalingOperator
(
2.456
,
space
)(
select_s1
*
select_s2
)
pos
=
ift
.
from_random
(
"normal"
,
dom
)
ift
.
extra
.
check_value_gradient_consistency
(
model
,
pos
,
ntries
=
20
)
model
=
ift
.
positive_tanh
(
model
=
ift
.
sigmoid
(
ift
.
ScalingOperator
(
2.456
,
space
)(
select_s1
*
select_s2
))
pos
=
ift
.
from_random
(
"normal"
,
dom
)
ift
.
extra
.
check_value_gradient_consistency
(
model
,
pos
,
ntries
=
20
)
...
...
@@ -91,7 +91,7 @@ def testModelLibrary(space, seed):
# Tests amplitude model and coorelated field model
Npixdof
,
ceps_a
,
ceps_k
,
sm
,
sv
,
im
,
iv
=
4
,
0.5
,
2.
,
3.
,
1.5
,
1.75
,
1.3
np
.
random
.
seed
(
seed
)
model
=
ift
.
Amplitude
Model
(
space
,
Npixdof
,
ceps_a
,
ceps_k
,
sm
,
sv
,
im
,
iv
)
model
=
ift
.
Amplitude
Operator
(
space
,
Npixdof
,
ceps_a
,
ceps_k
,
sm
,
sv
,
im
,
iv
)
S
=
ift
.
ScalingOperator
(
1.
,
model
.
domain
)
pos
=
S
.
draw_sample
()
ift
.
extra
.
check_value_gradient_consistency
(
model
,
pos
,
ntries
=
20
)
...
...
@@ -107,6 +107,6 @@ def testPointModel(space, seed):
pos
=
S
.
draw_sample
()
alpha
=
1.5
q
=
0.73
model
=
ift
.
InverseGamma
Model
(
space
,
alpha
,
q
)
model
=
ift
.
InverseGamma
Operator
(
space
,
alpha
,
q
)
# FIXME All those cdfs and ppfs are not very accurate
ift
.
extra
.
check_value_gradient_consistency
(
model
,
pos
,
tol
=
1e-2
,
ntries
=
20
)
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