@@ -765,28 +765,30 @@ def make_node(self, *inputs):
765
765
for inp , inp_t in zip (non_shared_inputs , self .input_types )
766
766
]
767
767
768
- shared_inputs = inputs [num_expected_inps :]
769
- local_shared_inputs = self .inner_inputs [num_expected_inps :]
770
-
771
- inner_and_input_shareds = list (zip (local_shared_inputs , shared_inputs ))
768
+ inner_and_input_shareds = list (
769
+ zip (self .shared_inputs , inputs [num_expected_inps :])
770
+ )
772
771
773
772
if not all (inp_s == inn_s for inn_s , inp_s in inner_and_input_shareds ):
774
773
# The shared variables are not equal to the original shared
775
774
# variables, so we construct a new `Op` that uses the new shared
776
- # variables instead
777
- replace = {
778
- old_inp : new_inp for old_inp , new_inp in zip (self .inner_inputs , inputs )
779
- }
780
- replace .update (inner_and_input_shareds )
775
+ # variables instead.
776
+ # All this is really doing is making the unused (internally, at
777
+ # least) `self.outputs` and `self.shared_inputs` consistent.
778
+ # We could just as easily `copy` this `Op`, update
779
+ # `self.shared_inputs`, and avoid cloning anything, but this is a
780
+ # more "change-proof" approach, because it still work when/if those
781
+ # attributes end up being used.
782
+ replace = dict (inner_and_input_shareds )
781
783
782
784
# If the new shared variables are inconsistent with the inner-graph,
783
785
# such errors should arise in this step
784
786
new_outputs = clone_replace (
785
- self .inner_outputs , replace = replace , share_inputs = True
787
+ self .outputs , replace = replace , share_inputs = True
786
788
)
787
789
788
790
new_op = type (self )(
789
- inputs = non_shared_inputs ,
791
+ inputs = self . inputs ,
790
792
outputs = new_outputs ,
791
793
inline = self .is_inline ,
792
794
lop_overrides = self .lop_overrides ,
0 commit comments