Skip to content

Commit fd834aa

Browse files
committed
Fix: handling case where bias is generated from another node
1 parent bf1840d commit fd834aa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/qonnx/transformation/resize_conv_to_deconv.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,13 @@ def apply(self, model):
217217
# Make sure to keep the biases from the convolution
218218
if len(conv.input) == 3:
219219
bias_name = conv.input[2]
220-
B_conv = model.get_initializer(bias_name) # (OC,)
220+
bias_prod = model.find_producer(bias_name)
221+
# If the producer is None, then it is initialized by the Conv node
222+
# and we need to ensure it isn't removed with the Conv node
223+
if bias_prod is None:
224+
B_conv = model.get_initializer(bias_name) # (OC,)
225+
model.set_initializer(bias_name, B_conv)
221226
deconv_inps.append(bias_name) # add to the inputs
222-
model.set_initializer(bias_name, B_conv)
223227
deconv_outs = conv.output
224228
deconv_pad = pad
225229
deconv_node = helper.make_node(

0 commit comments

Comments
 (0)