Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Commits
1c1a6b51
Commit
1c1a6b51
authored
5 years ago
by
Philipp Arras
Browse files
Options
Downloads
Patches
Plain Diff
MPI fixups
parent
820ddd40
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!339
Linearizationtests
Pipeline
#52936
passed
5 years ago
Stage: build_docker
Stage: test
Stage: demo_runs
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_linearization.py
+4
-4
4 additions, 4 deletions
test/test_linearization.py
with
4 additions
and
4 deletions
test/test_linearization.py
+
4
−
4
View file @
1c1a6b51
...
...
@@ -25,7 +25,7 @@ pmp = pytest.mark.parametrize
def
_lin2grad
(
lin
):
return
lin
.
jac
(
ift
.
full
(
lin
.
domain
,
1.
)).
lo
c
al_data
return
lin
.
jac
(
ift
.
full
(
lin
.
domain
,
1.
)).
to_g
lo
b
al_data
()
def
jt
(
lin
,
check
):
...
...
@@ -36,7 +36,7 @@ def test_special_gradients():
dom
=
ift
.
UnstructuredDomain
((
1
,))
f
=
ift
.
full
(
dom
,
2.4
)
var
=
ift
.
Linearization
.
make_var
(
f
)
s
=
f
.
lo
c
al_data
s
=
f
.
to_g
lo
b
al_data
()
jt
(
var
.
clip
(
0
,
10
),
np
.
ones_like
(
s
))
jt
(
var
.
clip
(
-
1
,
0
),
np
.
zeros_like
(
s
))
...
...
@@ -62,8 +62,8 @@ def test_actual_gradients(f):
eps
=
1e-8
var0
=
ift
.
Linearization
.
make_var
(
fld
)
var1
=
ift
.
Linearization
.
make_var
(
fld
+
eps
)
f0
=
getattr
(
var0
,
f
)().
val
.
lo
c
al_data
f1
=
getattr
(
var1
,
f
)().
val
.
lo
c
al_data
f0
=
getattr
(
var0
,
f
)().
val
.
to_g
lo
b
al_data
()
f1
=
getattr
(
var1
,
f
)().
val
.
to_g
lo
b
al_data
()
df0
=
(
f1
-
f0
)
/
eps
df1
=
_lin2grad
(
getattr
(
var0
,
f
)())
assert_allclose
(
df0
,
df1
,
rtol
=
100
*
eps
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment