Skip to content

[torchlib] Remove aten.linear #1819

Description

Un-register

@torch_op("aten::linear")
def aten_linear(input: TFloat, weight: TFloat) -> TFloat:
"""linear(Tensor input, Tensor weight, Tensor? bias=None) -> Tensor"""
# NOTE: The symbolic function in torch.onnx also uses Gemm in certain cases
# Optimizers may consider this path and replace it with Gemm
# We do not use Gemm here because input can have batch dimensions, which Gemm does not support
weight_transposed = op.Transpose(weight, perm=[1, 0])
return op.MatMul(input, weight_transposed)
as it is decomposed by pytorch to Gemm and is required for model accuracy.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

contribution welcomeWe welcome code contributions for thismodule: torchlibRelated to the torch/aten function lib in development

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions