Skip to content

Commit c7d9e8f

Browse files
committed
fix add handler
1 parent 8efd659 commit c7d9e8f

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
@@ -389,8 +389,7 @@ def _add_handler(self, trans, node):
389389
utils.make_sure(rank in (1, 4), "only support bias rank = 4 or 1")
390390
# to make rank = 4
391391
if rank == 1:
392-
for _ in range(3):
393-
numpy_val = np.expand_dims(numpy_val, axis=0)
392+
numpy_val = numpy_val.reshape((1, 1, 1, numpy_val.shape[0]))
394393

395394
transposed_val = np.transpose(numpy_val, (0, 3, 1, 2))
396395
target_node.set_tensor_value(transposed_val)

0 commit comments

Comments
 (0)