Skip to content

Commit bc10e2b

Browse files
Remove unnecessary constant cloning from aesara.scan.opt rewrites
1 parent b990275 commit bc10e2b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

aesara/scan/opt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def remove_constants_and_unused_inputs_scan(fgraph, node):
123123
try:
124124
# This works if input is a constant that has all entries
125125
# equal
126-
givens[op_ins[idx]] = node_inp.clone()[0]
126+
givens[op_ins[idx]] = node_inp[0]
127127
except TypeError:
128128
pass
129129
elif op_ins[idx] in all_ins:
@@ -148,7 +148,7 @@ def remove_constants_and_unused_inputs_scan(fgraph, node):
148148
nw_outer_nonseq = []
149149
for idx, (nw_in, nw_out) in enumerate(zip(non_seqs, outer_non_seqs)):
150150
if isinstance(nw_out, Constant):
151-
givens[nw_in] = nw_out.clone()
151+
givens[nw_in] = nw_out
152152
elif nw_in in all_ins:
153153
# Indices of elements of nw_outer_nonseq that are equivalent
154154
# to nw_out.
@@ -697,7 +697,7 @@ def push_out_inner_vars(
697697
new_outer_var = old_scan_args.outer_in_non_seqs[idx_non_seq]
698698

699699
elif isinstance(var, Constant):
700-
new_outer_var = var.clone()
700+
new_outer_var = var
701701

702702
elif var in old_scan_args.inner_out_nit_sot:
703703
idx_nitsot = old_scan_args.inner_out_nit_sot.index(var)

0 commit comments

Comments
 (0)