Skip to content

Commit 6e9885c

Browse files
committed
fix bug of function "pack_op"
tf.pack can accept only one input tensor, it doesn't change the input data under this case
1 parent 8124b98 commit 6e9885c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tf2onnx/tfonnx.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,12 @@ def minmax_op(ctx, node, name, args):
12671267

12681268

12691269
def pack_op(ctx, node, name, args):
1270+
# in tf, "pack" can accept one input tensor which means doing nothing,
1271+
# so remove the node in ONNX
1272+
if len(node.inputs) == 1:
1273+
ctx.replace_all_inputs(ctx.get_nodes(), node.output[0], node.input[0])
1274+
return None
1275+
12701276
# hack to make up for the missing onnx pack op
12711277
axis = node.get_attr("axis").i
12721278
if axis < 0:

0 commit comments

Comments
 (0)