cgerum opened a new issue #8507: URL: https://github.com/apache/tvm/issues/8507
In Opset 13 of ONNX ReduceSum has been changed to take reduce axis from an input tensor instead of an attribute: https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceSum-13. This is not correctly handled in `from_onnx`. ``` Traceback (most recent call last): File "test_reduce_sum.py", line 26, in <module> test_sum() File "test_reduce_sum.py", line 21, in test_sum mod, params = tvm.relay.frontend.from_onnx(onnx_data, opset=13) File "/local/gerum/speech_recognition/external/hannah-tvm/external/tvm/python/tvm/relay/frontend/onnx.py", line 3933, in from_onnx mod, params = g.from_onnx(graph, opset) File "/local/gerum/speech_recognition/external/hannah-tvm/external/tvm/python/tvm/relay/frontend/onnx.py", line 3709, in from_onnx op = self._convert_operator(op_name, inputs, attr, opset) File "/local/gerum/speech_recognition/external/hannah-tvm/external/tvm/python/tvm/relay/frontend/onnx.py", line 3838, in _convert_operator sym = convert_map[op_name](inputs, attrs, self._params) File "/local/gerum/speech_recognition/external/hannah-tvm/external/tvm/python/tvm/relay/frontend/onnx.py", line 1639, in _impl_v1 return AttrCvt(cls.name)(inputs, attr) File "/local/gerum/speech_recognition/external/hannah-tvm/external/tvm/python/tvm/relay/frontend/common.py", line 435, in __call__ return get_relay_op(op_name)(*inputs, **new_attrs) TypeError: sum() got multiple values for argument 'axis' ``` This error can be reproduced using the following test case: ``` import torch import onnx import tvm, tvm.relay class TestSum(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.sum(x, dim=2, keepdim=True) def test_sum(): model = TestSum() dummy_input = torch.rand((1,2,3)) torch.onnx.export(model, dummy_input, 'test_sum.onnx', verbose=True, opset_version=13) onnx_data = onnx.load('test_sum.onnx') mod, params = tvm.relay.frontend.from_onnx(onnx_data, opset=13) print(mod) if __name__ == "__main__": test_sum() ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
