-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the raising to high level operator within Unify Axis #565
Conversation
…ed variables we will know the right relationship.
…nd the inames in an IndexLambda.
Unsubscribing... @-mention or request review once it's ready for a look or needs attention. |
…ator working on an IndexLambda.
…nternal function.
…g the equations and propagate that information through.
…can store the reduction string as well.
pytato/transform/metadata.py
Outdated
if isinstance(var_ind_name, prim.Variable): | ||
lhs: str = self.get_var_for_axis(expr.bindings[vname], | ||
axis_ind) | ||
if IDX_LAMBDA_INAME.fullmatch(var_ind_name.name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an else
case here, to document that you've thought about it. E.g.
else:
raise AssertionError()
Unsubscribing... @-mention or request review once it's ready for a look or needs attention. |
…which cannot be transformed into one.
…dled in IndexLambdas. This propogates metadata through partially indexed axes of arrays.
… version requires us to later check with the index lambda version as well. However, we do not want to convert the expressions to index lambdas permanently.
pytato/transform/metadata.py
Outdated
elif BINDING_NAME_RESERVED_PATTERN.fullmatch(ind_name): | ||
raise AssertionError(f"Expression: {idx_lambda.expr}" + | ||
"indexes into an array using a binding name.") | ||
else: | ||
raise AssertionError(f"Expression: {idx_lambda.expr}" + | ||
"indexes into an array with an unknown variable name.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these errors? They can happen (hence AssertionError
is misplaced), and I wouldn't consider them illegal. (I've removed them.)
pytato/transform/metadata.py
Outdated
""" | ||
return self.combine([base] + [self.rec(subexpr) for | ||
subexpr in expr.index_tuple]) | ||
return {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code path is missing a recursion. (I've added it.)
pytato/transform/metadata.py
Outdated
for (ary, ax), ax_var in equations_collector.axis_to_var.items(): | ||
# Reduction axes do not follow AxisIgnoredForPropagation. | ||
# They cannot propagate the information to descendant of the array anyway. | ||
if isinstance(ax, int) and ary.axes[ax].tags_of_type(AxisIgnoredForPropagationTag): # noqa | ||
ignored_vars.update({ax_var}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why shouldn't reduction axes participate in this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I've added a FIXME.)
pytato/transform/metadata.py
Outdated
ind_name: str = var_ind_name.name | ||
matched_pattern = IDX_LAMBDA_RESERVED_INDEX_PATTERN.fullmatch(ind_name) # noqa | ||
if matched_pattern: | ||
# matched with an axis index. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we say this should only apply if the lengths match? (I've added that check.)
c47567a
to
62f7fb4
Compare
Fixes for mypy will come via #581. |
No description provided.