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
ift
NIFTy
Commits
6451fc0c
Commit
6451fc0c
authored
Jun 19, 2020
by
Martin Reinecke
Browse files
adjust tolerances in unit tests
parent
ee9cf92b
Pipeline
#76956
passed with stages
in 11 minutes and 48 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test/test_energy_gradients.py
View file @
6451fc0c
...
...
@@ -61,10 +61,10 @@ def test_studentt(field):
if
isinstance
(
field
.
domain
,
ift
.
MultiDomain
):
return
energy
=
ift
.
StudentTEnergy
(
domain
=
field
.
domain
,
theta
=
.
5
)
ift
.
extra
.
check_operator
(
energy
,
field
,
tol
=
1e-6
)
ift
.
extra
.
check_operator
(
energy
,
field
)
theta
=
ift
.
from_random
(
field
.
domain
,
'normal'
).
exp
()
energy
=
ift
.
StudentTEnergy
(
domain
=
field
.
domain
,
theta
=
theta
)
ift
.
extra
.
check_operator
(
energy
,
field
,
tol
=
1e-6
,
ntries
=
ntries
)
ift
.
extra
.
check_operator
(
energy
,
field
,
ntries
=
ntries
)
def
test_hamiltonian_and_KL
(
field
):
...
...
@@ -84,7 +84,7 @@ def test_variablecovariancegaussian(field):
dc
=
{
'a'
:
field
,
'b'
:
field
.
ptw
(
"exp"
)}
mf
=
ift
.
MultiField
.
from_dict
(
dc
)
energy
=
ift
.
VariableCovarianceGaussianEnergy
(
field
.
domain
,
'a'
,
'b'
,
np
.
float64
)
ift
.
extra
.
check_operator
(
energy
,
mf
,
tol
=
1e-6
,
ntries
=
ntries
)
ift
.
extra
.
check_operator
(
energy
,
mf
,
ntries
=
ntries
)
energy
(
ift
.
Linearization
.
make_var
(
mf
,
want_metric
=
True
)).
metric
.
draw_sample
()
...
...
@@ -93,7 +93,7 @@ def test_specialgamma(field):
return
energy
=
ift
.
operators
.
energy_operators
.
_SpecialGammaEnergy
(
field
)
loc
=
ift
.
from_random
(
energy
.
domain
).
exp
()
ift
.
extra
.
check_operator
(
energy
,
loc
,
tol
=
1e-6
,
ntries
=
ntries
)
ift
.
extra
.
check_operator
(
energy
,
loc
,
ntries
=
ntries
)
energy
(
ift
.
Linearization
.
make_var
(
loc
,
want_metric
=
True
)).
metric
.
draw_sample
()
...
...
@@ -105,7 +105,7 @@ def test_inverse_gamma(field):
d
=
ift
.
random
.
current_rng
().
normal
(
10
,
size
=
space
.
shape
)
**
2
d
=
ift
.
Field
(
space
,
d
)
energy
=
ift
.
InverseGammaLikelihood
(
d
)
ift
.
extra
.
check_operator
(
energy
,
field
,
tol
=
1e-
5
)
ift
.
extra
.
check_operator
(
energy
,
field
,
tol
=
1e-
10
)
def
testPoissonian
(
field
):
...
...
@@ -116,7 +116,7 @@ def testPoissonian(field):
d
=
ift
.
random
.
current_rng
().
poisson
(
120
,
size
=
space
.
shape
)
d
=
ift
.
Field
(
space
,
d
)
energy
=
ift
.
PoissonianEnergy
(
d
)
ift
.
extra
.
check_operator
(
energy
,
field
,
tol
=
1e-6
)
ift
.
extra
.
check_operator
(
energy
,
field
)
def
test_bernoulli
(
field
):
...
...
@@ -127,4 +127,4 @@ def test_bernoulli(field):
d
=
ift
.
random
.
current_rng
().
binomial
(
1
,
0.1
,
size
=
space
.
shape
)
d
=
ift
.
Field
(
space
,
d
)
energy
=
ift
.
BernoulliEnergy
(
d
)
ift
.
extra
.
check_operator
(
energy
,
field
,
tol
=
1e-
5
)
ift
.
extra
.
check_operator
(
energy
,
field
,
tol
=
1e-
10
)
test/test_operators/test_jacobian.py
View file @
6451fc0c
...
...
@@ -125,7 +125,7 @@ def testDynamicModel(target, causal, minimum_phase, seed):
'minimum_phase'
:
minimum_phase
}
model
,
_
=
ift
.
dynamic_operator
(
**
dct
)
pos
=
ift
.
from_random
(
model
.
domain
,
'normal'
)
ift
.
extra
.
check_operator
(
model
,
pos
,
tol
=
1e-7
,
ntries
=
ntries
)
ift
.
extra
.
check_operator
(
model
,
pos
,
ntries
=
ntries
)
if
len
(
target
.
shape
)
>
1
:
dct
=
{
'target'
:
target
,
...
...
@@ -144,7 +144,7 @@ def testDynamicModel(target, causal, minimum_phase, seed):
dct
[
'quant'
]
=
5
model
,
_
=
ift
.
dynamic_lightcone_operator
(
**
dct
)
pos
=
ift
.
from_random
(
model
.
domain
,
'normal'
)
ift
.
extra
.
check_operator
(
model
,
pos
,
tol
=
1e-7
,
ntries
=
ntries
)
ift
.
extra
.
check_operator
(
model
,
pos
,
ntries
=
ntries
)
@
pmp
(
'h_space'
,
_h_spaces
)
...
...
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