Open
Description
In some exported model with ConvTranspose I'm seeing the wrong shape for bias:
where B
should have shape (128) instead of (256) according to the ONNX spec.
Looking at the onnxscript code, the problem seems to be that since
_aten_convolution_onnx()
is used for both Conv and ConvTranspose, the logic for filling in bias should check the 0th dimension of weight if it's Conv and the 1st dimension of weight if it's ConvTranspose:
if bias is None:
weight_dim_0 = op.Shape(weight, start=0, end=1)
bias_shape = op.Expand(weight_dim_0, op.Constant(value_ints=[1]))
zero = op.CastLike(0.0, input)
bias = op.Expand(zero, bias_shape)
I think the value of groups
is also needed since the shape of weight is (M x C/group x kH x kW) for Conv and (C x M/group x kH x kW) for ConvTranspose?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment