Skip to content

Commit 05bed7b

Browse files
committed
Fix broken check in save_mem_new_scan
Without extracting the underlying numeric value of a constant TensorVariable `length`, `stop == length` would always fail.
1 parent 0b632bd commit 05bed7b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pytensor/scan/rewriting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ def save_mem_new_scan(fgraph, node):
13391339
stop = at.extract_constant(cf_slice[0].stop)
13401340
else:
13411341
stop = at.extract_constant(cf_slice[0]) + 1
1342-
if stop == maxsize or stop == length:
1342+
if stop == maxsize or stop == at.extract_constant(length):
13431343
stop = None
13441344
else:
13451345
# there is a **gotcha** here ! Namely, scan returns an

0 commit comments

Comments
 (0)