Skip to content

Fix overly strict check in local_pow_specialize rewrite #402

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

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions pytensor/tensor/rewriting/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -2072,11 +2072,10 @@ def local_pow_specialize(fgraph, node):
if np.all(y == -2):
rval = [reciprocal(sqr(xsym))]
if rval:
if not rval[0].type.broadcastable == node.outputs[0].type.broadcastable:
return None
rval[0] = cast(rval[0], odtype)
assert rval[0].type.is_super(node.outputs[0].type), (
rval[0].type,
node.outputs[0].type,
)
assert rval[0].type.dtype == node.outputs[0].type.dtype
return rval
else:
return False
Expand Down