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
37a61820
Commit
37a61820
authored
3 years ago
by
Andreas Klöckner
Committed by
Andreas Klöckner
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Improve error message for arithmetic on frozen array container
parent
8e5dbc5f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arraycontext/container/arithmetic.py
+16
-3
16 additions, 3 deletions
arraycontext/container/arithmetic.py
with
16 additions
and
3 deletions
arraycontext/container/arithmetic.py
+
16
−
3
View file @
37a61820
...
...
@@ -274,6 +274,12 @@ def with_container_arithmetic(
from numbers import Number
import numpy as np
from arraycontext import ArrayContainer
def _raise_if_actx_none(actx):
if actx is None:
raise ValueError(
"
array containers with frozen arrays
"
"
cannot be operated upon
"
)
return actx
"""
)
gen
(
""
)
...
...
@@ -375,8 +381,11 @@ def with_container_arithmetic(
gen
(
f
"
return cls(
{
zip_init_args
}
)
"
)
if
_bcast_actx_array_type
:
bcast_actx_ary_types
:
Tuple
[
str
,
...]
=
(
"
*arg1.array_context.array_types
"
,)
if
__debug__
:
bcast_actx_ary_types
:
Tuple
[
str
,
...]
=
(
"
*_raise_if_actx_none(arg1.array_context).array_types
"
,)
else
:
bcast_actx_ary_types
=
(
"
*arg1.array_context.array_types
"
,)
else
:
bcast_actx_ary_types
=
()
...
...
@@ -410,7 +419,11 @@ def with_container_arithmetic(
})
if
_bcast_actx_array_type
:
bcast_actx_ary_types
=
(
"
*arg2.array_context.array_types
"
,)
if
__debug__
:
bcast_actx_ary_types
=
(
"
*_raise_if_actx_none(arg2.array_context).array_types
"
,)
else
:
bcast_actx_ary_types
=
(
"
*arg2.array_context.array_types
"
,)
else
:
bcast_actx_ary_types
=
()
...
...
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