Skip to content
Snippets Groups Projects
Commit 35dc2614 authored by Kaushik Kulkarni's avatar Kaushik Kulkarni Committed by Andreas Klöckner
Browse files

_normalize_pt_expr: perform the transformation for a dict-of-named-arrays

parent f50736c1
No related branches found
No related tags found
No related merge requests found
Pipeline #198741 passed
...@@ -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: DictOfNamedArrays) -> Tuple[DictOfNamedArrays,
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment