Skip to content

aten::conv3d onnx export bug when bias is missing #2931

@bas-aarts

Description

@bas-aarts

This issue has not repro case, it just points out the issue.

aten::conv3d has the following code when bias is missing:

if bias is None:
weight_dim_0 = op.Shape(weight, start=0, end=1)
bias_shape = op.Concat(weight_dim_0, op.Constant(value_ints=[2]), axis=0)
zero = op.CastLike(0.0, input)
bias = op.Expand(zero, bias_shape)

This code is copy-pasted for the aten::conv3d_complex code:

if bias is None:
weight_dim_0 = op.Shape(weight, start=0, end=1)
bias_shape = op.Concat(weight_dim_0, op.Constant(value_ints=[2]), axis=0)
zero = op.CastLike(0.0, input)
bias = op.Expand(zero, bias_shape)

and it therefore generates a 2D bias, which is incorrect for non-complex conv3d. This will cause downstream issues.

the aten::conv1d and aten:::conv2d onnx export is correct, and that code should be used instead:

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions