@@ -1147,7 +1147,7 @@ def perform(self, node, inputs, output_storage):
1147
1147
else :
1148
1148
variables = from_return_values (self .impl (* inputs ))
1149
1149
assert len (variables ) == len (output_storage )
1150
- for storage , variable in zip (output_storage , variables ):
1150
+ for storage , variable in zip (output_storage , variables , strict = True ):
1151
1151
storage [0 ] = variable
1152
1152
1153
1153
def impl (self , * inputs ):
@@ -4109,7 +4109,9 @@ def c_support_code(self, **kwargs):
4109
4109
4110
4110
def c_support_code_apply (self , node , name ):
4111
4111
rval = []
4112
- for subnode , subnodename in zip (self .fgraph .toposort (), self .nodenames ):
4112
+ for subnode , subnodename in zip (
4113
+ self .fgraph .toposort (), self .nodenames , strict = True
4114
+ ):
4113
4115
subnode_support_code = subnode .op .c_support_code_apply (
4114
4116
subnode , subnodename % dict (nodename = name )
4115
4117
)
@@ -4215,7 +4217,7 @@ def __init__(self, inputs, outputs, name="Composite"):
4215
4217
res2 = pytensor .compile .rebuild_collect_shared (
4216
4218
inputs = outputs [0 ].owner .op .inputs ,
4217
4219
outputs = outputs [0 ].owner .op .outputs ,
4218
- replace = dict (zip (outputs [0 ].owner .op .inputs , res [1 ])),
4220
+ replace = dict (zip (outputs [0 ].owner .op .inputs , res [1 ], strict = True )),
4219
4221
)
4220
4222
assert len (res2 [1 ]) == len (outputs )
4221
4223
assert len (res [0 ]) == len (inputs )
@@ -4301,7 +4303,7 @@ def make_node(self, *inputs):
4301
4303
assert len (inputs ) == self .nin
4302
4304
res = pytensor .compile .rebuild_collect_shared (
4303
4305
self .outputs ,
4304
- replace = dict (zip (self .inputs , inputs )),
4306
+ replace = dict (zip (self .inputs , inputs , strict = True )),
4305
4307
rebuild_strict = False ,
4306
4308
)
4307
4309
# After rebuild_collect_shared, the Variable in inputs
@@ -4314,7 +4316,7 @@ def make_node(self, *inputs):
4314
4316
4315
4317
def perform (self , node , inputs , output_storage ):
4316
4318
outputs = self .py_perform_fn (* inputs )
4317
- for storage , out_val in zip (output_storage , outputs ):
4319
+ for storage , out_val in zip (output_storage , outputs , strict = True ):
4318
4320
storage [0 ] = out_val
4319
4321
4320
4322
def grad (self , inputs , output_grads ):
@@ -4384,8 +4386,8 @@ def c_code_template(self):
4384
4386
def c_code (self , node , nodename , inames , onames , sub ):
4385
4387
d = dict (
4386
4388
chain (
4387
- zip ((f"i{ int (i )} " for i in range (len (inames ))), inames ),
4388
- zip ((f"o{ int (i )} " for i in range (len (onames ))), onames ),
4389
+ zip ((f"i{ int (i )} " for i in range (len (inames ))), inames , strict = True ),
4390
+ zip ((f"o{ int (i )} " for i in range (len (onames ))), onames , strict = True ),
4389
4391
),
4390
4392
** sub ,
4391
4393
)
@@ -4433,7 +4435,7 @@ def apply(self, fgraph):
4433
4435
)
4434
4436
# make sure we don't produce any float16.
4435
4437
assert not any (o .dtype == "float16" for o in new_node .outputs )
4436
- for o , no in zip (node .outputs , new_node .outputs ):
4438
+ for o , no in zip (node .outputs , new_node .outputs , strict = True ):
4437
4439
mapping [o ] = no
4438
4440
4439
4441
new_ins = [mapping [inp ] for inp in fgraph .inputs ]
@@ -4477,7 +4479,7 @@ def handle_composite(node, mapping):
4477
4479
new_op = node .op .clone_float32 ()
4478
4480
new_outs = new_op (* [mapping [i ] for i in node .inputs ], return_list = True )
4479
4481
assert len (new_outs ) == len (node .outputs )
4480
- for o , no in zip (node .outputs , new_outs ):
4482
+ for o , no in zip (node .outputs , new_outs , strict = True ):
4481
4483
mapping [o ] = no
4482
4484
4483
4485
0 commit comments