Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arraycontext
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexandru Fikl
arraycontext
Commits
b0af7bfb
Commit
b0af7bfb
authored
3 years ago
by
Kaushik Kulkarni
Browse files
Options
Downloads
Patches
Plain Diff
take to_numpy before comparing actx's scalars
parent
c1d90703
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
test/test_arraycontext.py
+5
-7
5 additions, 7 deletions
test/test_arraycontext.py
with
5 additions
and
7 deletions
test/test_arraycontext.py
+
5
−
7
View file @
b0af7bfb
...
...
@@ -257,7 +257,7 @@ def test_actx_stack(actx_factory):
ndofs
=
5000
args
=
[
np
.
random
.
randn
(
ndofs
)
for
i
in
range
(
10
)]
assert_close_to_numpy
(
assert_close_to_numpy
_in_containers
(
actx
,
lambda
_np
,
*
_args
:
_np
.
stack
(
_args
),
args
)
...
...
@@ -656,9 +656,8 @@ def test_container_arithmetic(actx_factory):
bcast_result
=
ary_dof
+
bcast_dc_of_dofs
bcast_dc_of_dofs
+
ary_dof
res
=
bcast_result
.
mass
-
2
*
ary_of_dofs
assert
np
.
linalg
.
norm
(
actx
.
to_numpy
(
res
[
0
][
0
])
<
1e-8
)
assert
actx
.
to_numpy
(
actx
.
np
.
linalg
.
norm
(
bcast_result
.
mass
-
2
*
ary_of_dofs
))
<
1e-8
mock_gradient
=
MyContainerDOFBcast
(
name
=
"
yo
"
,
...
...
@@ -670,9 +669,8 @@ def test_container_arithmetic(actx_factory):
assert
isinstance
(
grad_matvec_result
.
mass
,
DOFArray
)
assert
grad_matvec_result
.
momentum
.
shape
==
(
3
,)
res
=
grad_matvec_result
.
mass
-
3
*
ary_of_dofs
**
2
assert
np
.
linalg
.
norm
(
actx
.
to_numpy
(
res
[
0
][
0
])
<
1e-8
)
assert
actx
.
to_numpy
(
actx
.
np
.
linalg
.
norm
(
grad_matvec_result
.
mass
-
3
*
ary_of_dofs
**
2
))
<
1e-8
# }}}
...
...
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