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
pycodegen
pystencils_autodiff
Commits
64fbd5eb
Commit
64fbd5eb
authored
Dec 17, 2019
by
Stephan Seitz
Browse files
Accelerate gradient check test by using smaller arrays
parent
c6e5fda1
Pipeline
#20587
passed with stage
in 5 minutes and 58 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
tests/test_tfmad.py
View file @
64fbd5eb
...
...
@@ -58,7 +58,7 @@ def test_tfmad_two_stencils():
def
test_tfmad_gradient_check
():
tf
=
pytest
.
importorskip
(
'tensorflow'
)
a
,
b
,
out
=
ps
.
fields
(
"a, b, out: double[
21,13
]"
)
a
,
b
,
out
=
ps
.
fields
(
"a, b, out: double[
5,6
]"
)
print
(
a
.
shape
)
cont
=
ps
.
fd
.
Diff
(
a
,
0
)
-
ps
.
fd
.
Diff
(
a
,
1
)
-
ps
.
fd
.
Diff
(
b
,
0
)
+
ps
.
fd
.
Diff
(
...
...
@@ -100,7 +100,7 @@ def test_tfmad_gradient_check():
def
test_tfmad_gradient_check_torch
():
torch
=
pytest
.
importorskip
(
'torch'
)
a
,
b
,
out
=
ps
.
fields
(
"a, b, out: float[
21,13
]"
)
a
,
b
,
out
=
ps
.
fields
(
"a, b, out: float[
5,7
]"
)
cont
=
2
*
ps
.
fd
.
Diff
(
a
,
0
)
-
1.5
*
ps
.
fd
.
Diff
(
a
,
1
)
\
-
ps
.
fd
.
Diff
(
b
,
0
)
+
3
*
ps
.
fd
.
Diff
(
b
,
1
)
...
...
@@ -136,7 +136,7 @@ def test_valid_boundary_handling_torch_native():
pytest
.
importorskip
(
'tensorflow'
)
import
tensorflow
as
tf
a
,
b
,
out
=
ps
.
fields
(
"a, b, out: double[
2
1,1
3
]"
)
a
,
b
,
out
=
ps
.
fields
(
"a, b, out: double[1
0
,1
1
]"
)
print
(
a
.
shape
)
cont
=
2
*
ps
.
fd
.
Diff
(
a
,
0
)
-
1.5
*
ps
.
fd
.
Diff
(
a
,
1
)
-
ps
.
fd
.
Diff
(
b
,
0
)
+
3
*
ps
.
fd
.
Diff
(
b
,
1
)
...
...
@@ -190,7 +190,7 @@ def test_tfmad_gradient_check_torch_native(with_offsets, with_cuda):
torch
=
pytest
.
importorskip
(
'torch'
)
import
torch
a
,
b
,
out
=
ps
.
fields
(
"a, b, out: float64[
21,13
]"
)
a
,
b
,
out
=
ps
.
fields
(
"a, b, out: float64[
5,7
]"
)
if
with_offsets
:
cont
=
2
*
ps
.
fd
.
Diff
(
a
,
0
)
-
1.5
*
ps
.
fd
.
Diff
(
a
,
1
)
-
ps
.
fd
.
Diff
(
b
,
0
)
+
3
*
ps
.
fd
.
Diff
(
b
,
1
)
...
...
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