Skip to content

Commit e67d9bd

Browse files
committed
make sure bias is 1D and has size of M
1 parent 728fcda commit e67d9bd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tf2onnx/optimizer/transpose_optimizer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,10 @@ def _add_handler(self, trans, node):
385385
if len(numpy_val.shape) - numpy_val.shape.count(1) > 1:
386386
self.logger.debug("Bias is not 1D, can not merge Conv and Add")
387387
return self._handle_node_having_branches(node)
388+
388389
bias_size = max(numpy_val.shape)
389-
M = t_p.inputs[1].output_shapes[0][0]
390-
if bias_size != M:
390+
size_m = t_p.inputs[1].output_shapes[0][0]
391+
if bias_size != size_m:
391392
self.logger.debug("Bias size is not M, can not merge Conv and Add")
392393
return self._handle_node_having_branches(node)
393394

0 commit comments

Comments
 (0)