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
Andreas Klöckner
arraycontext
Commits
35dc2614
Commit
35dc2614
authored
3 years ago
by
Kaushik Kulkarni
Committed by
Andreas Klöckner
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
_normalize_pt_expr: perform the transformation for a dict-of-named-arrays
parent
f50736c1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#198741
passed
3 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arraycontext/impl/pytato/utils.py
+5
-4
5 additions, 4 deletions
arraycontext/impl/pytato/utils.py
with
5 additions
and
4 deletions
arraycontext/impl/pytato/utils.py
+
5
−
4
View file @
35dc2614
...
@@ -25,7 +25,7 @@ THE SOFTWARE.
...
@@ -25,7 +25,7 @@ THE SOFTWARE.
from
typing
import
Any
,
Dict
,
Set
,
Tuple
,
Mapping
from
typing
import
Any
,
Dict
,
Set
,
Tuple
,
Mapping
from
pytato.array
import
SizeParam
,
Placeholder
from
pytato.array
import
SizeParam
,
Placeholder
from
pytato.array
import
Array
,
DataWrapper
from
pytato.array
import
Array
,
DataWrapper
,
DictOfNamedArrays
from
pytato.transform
import
CopyMapper
from
pytato.transform
import
CopyMapper
from
pytools
import
UniqueNameGenerator
from
pytools
import
UniqueNameGenerator
...
@@ -66,8 +66,8 @@ class _DatawrapperToBoundPlaceholderMapper(CopyMapper):
...
@@ -66,8 +66,8 @@ class _DatawrapperToBoundPlaceholderMapper(CopyMapper):
"
DatawrapperToBoundPlaceholderMapper.
"
)
"
DatawrapperToBoundPlaceholderMapper.
"
)
def
_normalize_pt_expr
(
expr
:
Array
)
->
Tuple
[
Array
,
def
_normalize_pt_expr
(
expr
:
DictOfNamed
Array
s
)
->
Tuple
[
DictOfNamed
Array
s
,
Mapping
[
str
,
Any
]]:
Mapping
[
str
,
Any
]]:
"""
"""
Returns ``(normalized_expr, bound_arguments)``. *normalized_expr* is a
Returns ``(normalized_expr, bound_arguments)``. *normalized_expr* is a
normalized form of *expr*, with all instances of
normalized form of *expr*, with all instances of
...
@@ -78,5 +78,6 @@ def _normalize_pt_expr(expr: Array) -> Tuple[Array,
...
@@ -78,5 +78,6 @@ def _normalize_pt_expr(expr: Array) -> Tuple[Array,
equivalent graphs.
equivalent graphs.
"""
"""
normalize_mapper
=
_DatawrapperToBoundPlaceholderMapper
()
normalize_mapper
=
_DatawrapperToBoundPlaceholderMapper
()
normalized_expr
=
normalize_mapper
(
expr
)
# type-ignore reason: Mapper.__call__ takes Array, passed DictOfNamedArrays
normalized_expr
=
normalize_mapper
(
expr
)
# type: ignore
return
normalized_expr
,
normalize_mapper
.
bound_arguments
return
normalized_expr
,
normalize_mapper
.
bound_arguments
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