✅ Obtain model graph with `torch.export.export`
❌ Translate the graph into ONNX
⚪ Run `onnx.checker` on the ONNX model
⚪ Execute the model with ONNX Runtime
⚪ Validate model output accuracy
Error message:
Traceback (most recent call last):
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_building.py", line 382, in eval
outputs = self._call_op(op_signature, named_inputs, named_attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_building.py", line 340, in _call_op
converted_named_inputs = _process_python_constants(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_building.py", line 253, in _process_python_constants
raise TypeError(
TypeError: Constant input '(SymbolicTensor('anonymous:13290656480', type=None, shape=None, producer=anonymous_node:13278755600, index=0), 0)' of type '<class 'tuple'>' is not supported
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_building.py", line 453, in eval_function
return function.function(**named_inputs, **named_attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/onnxscript/onnxscript/function_libs/torch_lib/ops/core.py", line 2582, in _aten_diagonal_onnx
length = op.Max(op.Min(length, min_dim_size), 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/onnxscript/onnxscript/onnx_opset/_impl/opset13.py", line 1809, in Max
return op(*self._prepare_inputs(schema, *data_0))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/onnxscript/onnxscript/values.py", line 300, in __call__
return evaluator.default().eval(schema, args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_building.py", line 387, in eval
raise RuntimeError(
RuntimeError: Error calling operator 'Max' with args (SymbolicTensor('anonymous:13290656480', type=None, shape=None, producer=anonymous_node:13278755600, index=0), 0) and kwargs {}.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_core.py", line 398, in _handle_call_function_node_with_lowering
outputs = onnx_function(*onnx_args, **onnx_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/onnxscript/onnxscript/values.py", line 582, in __call__
return self.func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/onnxscript/onnxscript/function_libs/torch_lib/ops/core.py", line 2534, in aten_diagonal
return _aten_diagonal_onnx(self, offset, dim1, dim2, perm, axes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/onnxscript/onnxscript/values.py", line 528, in __call__
return evaluator.default().eval_function(self, args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_building.py", line 462, in eval_function
raise RuntimeError(
RuntimeError: Error calling function '_aten_diagonal_onnx' with args (Input('arg0_1', type=Tensor(FLOAT), shape=[3,5,5], producer=None, index=None), 0, 1, 2, [0, 1, 2], [1]) and kwargs {}.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_core.py", line 490, in _add_nodes
_handle_call_function_node_with_lowering(
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_core.py", line 400, in _handle_call_function_node_with_lowering
raise RuntimeError(
RuntimeError: Error when calling function 'TracedOnnxFunction(<function aten_diagonal at 0x16864ce00>)' with args '[Input('arg0_1', type=Tensor(FLOAT), shape=[3,5,5], producer=None, index=None), 0, 1, 2]' and kwargs '{}'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_patch.py", line 222, in _torch_onnx_export
ir_model = torch_onnx.exported_program_to_ir(program)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_core.py", line 626, in exported_program_to_ir
values = _add_nodes(exported_program, model, lower=lower, registry=registry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_core.py", line 501, in _add_nodes
raise RuntimeError(
RuntimeError: Error when translating node %diagonal : [num_users=1] = call_function[target=torch.ops.aten.diagonal.default](args = (%arg0_1, 0, 1, 2), kwargs = {}). See the stack trace for more information.
PyTorch ONNX Conversion Error Report
Error message:
Exported program:
Analysis
PyTorch ONNX Conversion Analysis
Model Information
The model has 0 parameters and 0 buffers (non-trainable parameters). Number of parameters per dtype:
Number of buffers per dtype:
Inputs:
arg0_1
:TensorMetadata(shape=torch.Size([3, 5, 5]), dtype=torch.float32, requires_grad=False, stride=(25, 5, 1), memory_format=torch.contiguous_format, is_quantized=False, qparams={})
Outputs:
permute_1
:TensorMetadata(shape=torch.Size([3, 5]), dtype=torch.float32, requires_grad=False, stride=(25, 6), memory_format=None, is_quantized=False, qparams={})
The FX graph has 5 nodes in total. Number of FX nodes per op:
placeholder
: 1call_function
: 3output
: 1Of the call_function nodes, the counts of operators used are:
aten.permute.default
: 2aten.diagonal.default
: 1ONNX Conversion Information
All operators in the model have registered ONNX decompositions.