Skip to content

Commit cc52e5a

Browse files
committed
Fix einsum failing on repeated inputs
1 parent 0018263 commit cc52e5a

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed
199 KB
Binary file not shown.

pytensor/tensor/einsum.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,8 @@ def _ensure_not_equal(elements):
422422
Ensures that any pair in a list of elements are not the same object. If a pair of elements is found to be equal, then one of them is converted to a copy.
423423
"""
424424
elements = list(elements)
425-
n_elem = len(elements)
426425
for i, elem1 in enumerate(elements[:-1]):
427-
for j, elem2 in enumerate(elements[i + 1:], start=i+1):
426+
for j, elem2 in enumerate(elements[i + 1 :], start=i + 1):
428427
if elem1 is elem2:
429428
elements[j] = elem1.copy()
430429
return elements

0 commit comments

Comments
 (0)