We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 836eb45 commit c4f662aCopy full SHA for c4f662a
pytensor/tensor/rewriting/math.py
@@ -1923,10 +1923,13 @@ def local_pow_canonicalize(fgraph, node):
1923
new_out = None
1924
1925
if cst_base == 1:
1926
+ # 1 ** x = 1
1927
new_out = broadcast_arrays(*node.inputs)[0]
1928
elif cst_exponent == 0:
1929
+ # x ** 0 = 1
1930
new_out = broadcast_arrays(ones_like(node.inputs[0]), node.inputs[1])[0]
1931
elif cst_exponent == 1:
1932
+ # x ** 1 = x
1933
1934
1935
if not new_out:
0 commit comments