Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loopy
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
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ben Sepanski
loopy
Commits
2513f553
Commit
2513f553
authored
11 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Improve testing dtype for fill()-ability in auto_test
parent
78e0e2f2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
loopy/auto_test.py
+8
-3
8 additions, 3 deletions
loopy/auto_test.py
with
8 additions
and
3 deletions
loopy/auto_test.py
+
8
−
3
View file @
2513f553
...
...
@@ -37,6 +37,11 @@ import logging
logger
=
logging
.
getLogger
(
__name__
)
def
is_dtype_supported
(
dtype
):
# Work around https://github.com/numpy/numpy/issues/4317
return
dtype
.
kind
in
"
biufc
"
# {{{ create random argument arrays for testing
def
fill_rand
(
ary
):
...
...
@@ -127,7 +132,7 @@ def make_ref_args(kernel, impl_arg_info, queue, parameters, fill_value):
raise
RuntimeError
(
"
write-mode images not supported in
"
"
automatic testing
"
)
if
dtype
.
isbuiltin
:
if
is_
dtype
_supported
(
dtype
)
:
storage_array
.
fill
(
fill_value
)
else
:
from
warnings
import
warn
...
...
@@ -216,7 +221,7 @@ def make_args(kernel, impl_arg_info, queue, ref_arg_data, parameters,
storage_array
=
cl_array
.
empty
(
queue
,
alloc_size
,
dtype
)
ary
=
cl_array
.
as_strided
(
storage_array
,
shape
,
numpy_strides
)
if
dtype
.
isbuiltin
:
if
is_
dtype
_supported
(
dtype
)
:
storage_array
.
fill
(
fill_value
)
else
:
from
warnings
import
warn
...
...
@@ -277,7 +282,7 @@ def make_args(kernel, impl_arg_info, queue, ref_arg_data, parameters,
# {{{ default array comparison
def
_default_check_result
(
result
,
ref_result
):
if
not
result
.
dtype
.
isbuiltin
and
not
(
result
==
ref_result
).
all
():
if
not
is_dtype_supported
(
result
.
dtype
)
and
not
(
result
==
ref_result
).
all
():
return
(
False
,
"
results do not match exactly
"
)
if
not
np
.
allclose
(
ref_result
,
result
,
rtol
=
1e-3
,
atol
=
1e-3
):
...
...
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