@@ -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 ):
@@ -4111,7 +4111,9 @@ def c_support_code(self, **kwargs):
4111
4111
4112
4112
def c_support_code_apply (self , node , name ):
4113
4113
rval = []
4114
- for subnode , subnodename in zip (self .fgraph .toposort (), self .nodenames ):
4114
+ for subnode , subnodename in zip (
4115
+ self .fgraph .toposort (), self .nodenames , strict = True
4116
+ ):
4115
4117
subnode_support_code = subnode .op .c_support_code_apply (
4116
4118
subnode , subnodename % dict (nodename = name )
4117
4119
)
@@ -4217,7 +4219,7 @@ def __init__(self, inputs, outputs, name="Composite"):
4217
4219
res2 = pytensor .compile .rebuild_collect_shared (
4218
4220
inputs = outputs [0 ].owner .op .inputs ,
4219
4221
outputs = outputs [0 ].owner .op .outputs ,
4220
- replace = dict (zip (outputs [0 ].owner .op .inputs , res [1 ])),
4222
+ replace = dict (zip (outputs [0 ].owner .op .inputs , res [1 ], strict = True )),
4221
4223
)
4222
4224
assert len (res2 [1 ]) == len (outputs )
4223
4225
assert len (res [0 ]) == len (inputs )
@@ -4303,7 +4305,7 @@ def make_node(self, *inputs):
4303
4305
assert len (inputs ) == self .nin
4304
4306
res = pytensor .compile .rebuild_collect_shared (
4305
4307
self .outputs ,
4306
- replace = dict (zip (self .inputs , inputs )),
4308
+ replace = dict (zip (self .inputs , inputs , strict = True )),
4307
4309
rebuild_strict = False ,
4308
4310
)
4309
4311
# After rebuild_collect_shared, the Variable in inputs
@@ -4316,7 +4318,7 @@ def make_node(self, *inputs):
4316
4318
4317
4319
def perform (self , node , inputs , output_storage ):
4318
4320
outputs = self .py_perform_fn (* inputs )
4319
- for storage , out_val in zip (output_storage , outputs ):
4321
+ for storage , out_val in zip (output_storage , outputs , strict = True ):
4320
4322
storage [0 ] = out_val
4321
4323
4322
4324
def grad (self , inputs , output_grads ):
@@ -4386,8 +4388,8 @@ def c_code_template(self):
4386
4388
def c_code (self , node , nodename , inames , onames , sub ):
4387
4389
d = dict (
4388
4390
chain (
4389
- zip ((f"i{ int (i )} " for i in range (len (inames ))), inames ),
4390
- zip ((f"o{ int (i )} " for i in range (len (onames ))), onames ),
4391
+ zip ((f"i{ int (i )} " for i in range (len (inames ))), inames , strict = True ),
4392
+ zip ((f"o{ int (i )} " for i in range (len (onames ))), onames , strict = True ),
4391
4393
),
4392
4394
** sub ,
4393
4395
)
@@ -4435,7 +4437,7 @@ def apply(self, fgraph):
4435
4437
)
4436
4438
# make sure we don't produce any float16.
4437
4439
assert not any (o .dtype == "float16" for o in new_node .outputs )
4438
- for o , no in zip (node .outputs , new_node .outputs ):
4440
+ for o , no in zip (node .outputs , new_node .outputs , strict = True ):
4439
4441
mapping [o ] = no
4440
4442
4441
4443
new_ins = [mapping [inp ] for inp in fgraph .inputs ]
@@ -4479,7 +4481,7 @@ def handle_composite(node, mapping):
4479
4481
new_op = node .op .clone_float32 ()
4480
4482
new_outs = new_op (* [mapping [i ] for i in node .inputs ], return_list = True )
4481
4483
assert len (new_outs ) == len (node .outputs )
4482
- for o , no in zip (node .outputs , new_outs ):
4484
+ for o , no in zip (node .outputs , new_outs , strict = True ):
4483
4485
mapping [o ] = no
4484
4486
4485
4487
0 commit comments