Skip to content

Commit 176536f

Browse files
authored
Merge pull request #753 from jignparm/jignparm/fix_expanddims
Fix ExpandDims to always use Unsqueeze
2 parents 84cfa03 + 2893768 commit 176536f

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

tf2onnx/onnx_opset/tensor.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -603,16 +603,6 @@ def version_7(cls, ctx, node, **kwargs):
603603
# T output = ExpandDims(T input, Tdim dim, @type Tdim), dim is 0-D scalar.
604604
# T reshaped = Reshape-5(T data, int64 shape)
605605
# T expanded = Unsqueeze-1(T data, @ints axes)
606-
shape = ctx.get_shape(node.output[0])
607-
if shape is not None and shape.count(-1) < 2:
608-
# tensorflow already infers the output shape so we can just take it
609-
shape_name = utils.make_name(node.name)
610-
ctx.make_const(shape_name, np.array(shape, dtype=np.int64))
611-
node.type = "Reshape"
612-
node.input[1] = shape_name
613-
return
614-
615-
# if there is more than one -1 in the shape, Reshape won't support.
616606
dim_node = node.inputs[1]
617607
if dim_node.is_const():
618608
node.type = "Unsqueeze"

0 commit comments

Comments
 (0)