Skip to content

Commit baa8b1c

Browse files
committed
make sure bias is 1D and has size of M
1 parent 2fd0943 commit baa8b1c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tf2onnx/optimizer/transpose_optimizer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,11 @@ def _add_handler(self, trans, node):
387387
return self._handle_node_having_branches(node)
388388

389389
bias_size = max(numpy_val.shape)
390-
M = t_p.inputs[1].output_shapes[0]
390+
M = t_p.inputs[1].output_shapes[0][0]
391391
if bias_size != M:
392392
self.logger.debug("Bias size is not M, can not merge Conv and Add")
393393
return self._handle_node_having_branches(node)
394394

395-
numpy_val = target_node.get_tensor_value(as_list=False)
396395
target_val = numpy_val.reshape(bias_size)
397396
target_node.set_tensor_value(target_val)
398397

0 commit comments

Comments
 (0)