Skip to content

[regression][atenlib] #459 broke pytorch gpt2 export #489

@BowenBao

Description

@BowenBao

Discovered by pytorch/pytorch#95676, https://github.com/pytorch/pytorch/actions/runs/4306983689/jobs/7511796215. Introduced by #459

TL;DR

It seems axes is considered onnxAttributes, but got type TorchScriptTensor.

Is it because the type annotation for axes is wrong?
https://github.com/microsoft/onnx-script/blob/e66ca88c9b0beb6e45545d4c60d96c65e70c9db8/onnxscript/function_libs/torch_aten/ops/core.py#L3995

Why is this not caught in unittest?

Using sarif to pinpoint the error

Checking the generated diagnostic test_report_test_gpt2_tiny.sarif, with WARNING + ERROR filter
image

Viewing _add_torchscript_op_call as part of the analysis step, we could observe (in json unfortunately since sarif extension does not visualize step detail info)

           "state":{
            "name":"onnxscript.atenlib::_aten_native_layer_norm_onnx: <class 'str'>",
            "onnxInputs":"[TorchScriptTensor(None), TorchScriptTensor(None), TorchScriptTensor(None)]: <class 'list'>",
            "onnxAttributes":"OrderedDict([('axes', TorchScriptTensor(None)), ('eps', 1e-05)]): <class 'collections.OrderedDict'>",
            "nOutputs":"3: <class 'int'>"
           }

It shows axes is considered onnxAttributes, but got type TorchScriptTensor.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmodule: 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