Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set output shape of ConvTranspose (Conv2DBackpropInput) correctly #966

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tf2onnx/onnx_opset/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ def version_1(cls, ctx, node, **kwargs):
# Note: inputs are reversed from what one would expect.
conv_kernel_shape(ctx, node, 1)
input_shape = ctx.get_shape(node.input[2])
output_shape_orig = node.output_shapes

# ouput_shape is explicitly specified here, in this case pads values are auto generated/calculated.
if node.inputs[0].is_const():
Expand Down Expand Up @@ -285,7 +286,8 @@ def version_1(cls, ctx, node, **kwargs):
const_one_two = ctx.make_const(utils.make_name(node.name + "_const_one_two"),
np.array([1, 2], dtype=np.int64))
slice_node = ctx.make_node("Slice",
[node.output[0], starts.output[0], ends.output[0], const_one_two.output[0]])
[node.output[0], starts.output[0], ends.output[0], const_one_two.output[0]],
shapes=output_shape_orig)
downstream_nodes = ctx.find_output_consumers(node.output[0])
downstream_nodes.remove(output_shape)
downstream_nodes.remove(slice_node)
Expand Down