Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Bindgen
pystencils
Commits
32d636c4
Commit
32d636c4
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Extend test in test_interpolation.py
parent
fe94402a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils_tests/test_interpolation.py
+16
-13
16 additions, 13 deletions
pystencils_tests/test_interpolation.py
with
16 additions
and
13 deletions
pystencils_tests/test_interpolation.py
+
16
−
13
View file @
32d636c4
...
@@ -7,9 +7,11 @@
...
@@ -7,9 +7,11 @@
"""
"""
"""
"""
import
itertools
from
os.path
import
dirname
,
join
from
os.path
import
dirname
,
join
import
numpy
as
np
import
numpy
as
np
import
pytest
import
sympy
import
sympy
import
pycuda.autoinit
# NOQA
import
pycuda.autoinit
# NOQA
...
@@ -215,19 +217,20 @@ def test_rotate_interpolation_size_change():
...
@@ -215,19 +217,20 @@ def test_rotate_interpolation_size_change():
pyconrad
.
imshow
(
out
,
"
small out
"
+
address_mode
)
pyconrad
.
imshow
(
out
,
"
small out
"
+
address_mode
)
def
test_field_interpolated
():
@pytest.mark.parametrize
(
'
address_mode, target
'
,
itertools
.
product
([
'
border
'
,
'
wrap
'
,
'
clamp
'
,
'
mirror
'
],
[
'
cpu
'
,
'
gpu
'
]))
def
test_field_interpolated
(
address_mode
,
target
):
x_f
,
y_f
=
pystencils
.
fields
(
'
x,y: float64 [2d]
'
)
x_f
,
y_f
=
pystencils
.
fields
(
'
x,y: float64 [2d]
'
)
for
address_mode
in
[
'
border
'
,
'
wrap
'
,
'
clamp
'
,
'
mirror
'
]:
assignments
=
pystencils
.
AssignmentCollection
({
assignments
=
pystencils
.
AssignmentCollection
({
y_f
.
center
():
x_f
.
interpolated_access
([
0.5
*
x_
+
2.7
,
0.25
*
y_
+
7.2
],
address_mode
=
address_mode
)
y_f
.
center
():
x_f
.
interpolated_access
([
0.5
*
x_
+
2.7
,
0.25
*
y_
+
7.2
],
address_mode
=
address_mode
)
})
})
print
(
assignments
)
print
(
assignments
)
ast
=
pystencils
.
create_kernel
(
assignments
)
ast
=
pystencils
.
create_kernel
(
assignments
)
print
(
ast
)
print
(
ast
)
print
(
pystencils
.
show_code
(
ast
))
print
(
pystencils
.
show_code
(
ast
))
kernel
=
ast
.
compile
()
kernel
=
ast
.
compile
()
out
=
np
.
zeros_like
(
lenna
)
out
=
np
.
zeros_like
(
lenna
)
kernel
(
x
=
lenna
,
y
=
out
)
kernel
(
x
=
lenna
,
y
=
out
)
pyconrad
.
imshow
(
out
,
"
out
"
+
address_mode
)
pyconrad
.
imshow
(
out
,
"
out
"
+
address_mode
)
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