✅ 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/_core.py", line 480, in _add_nodes
_handle_call_function_node_with_lowering(
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_core.py", line 348, in _handle_call_function_node_with_lowering
onnx_function, message = _dispatching.dispatch(node, registry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_dispatching.py", line 326, in dispatch
overload, message = get_matching_overload(
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_dispatching.py", line 252, in get_matching_overload
first_tensor = _get_first_tensor_in_node_list(arg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_dispatching.py", line 180, in _get_first_tensor_in_node_list
if "val" in node.meta and isinstance(node.meta["val"], torch.Tensor):
^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'meta'
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 196, 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 619, 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 491, in _add_nodes
raise errors.OnnxConversionError(
torch_onnx.errors.OnnxConversionError: Error when translating node %index : [num_users=1] = call_function[target=torch.ops.aten.index.Tensor](args = (%slice_2, [None, %lift_fresh_copy, None, %lift_fresh_copy_1, %lift_fresh_copy_2]), kwargs = {}). See the stack trace for more information.
The FX graph has 11 nodes in total. Number of FX nodes per op:
placeholder: 4
call_function: 6
output: 1
Of the call_function nodes, the counts of operators used are:
aten.lift_fresh_copy.default: 3
aten.slice.Tensor: 2
aten.index.Tensor: 1
ONNX Conversion Information
The model contains operators the dispatcher could not find registered ONNX decompositions for. This may be due to missing implementations, decompositions not registered correctly, or a bug in the dispatcher.
Errors grouped by operator:
aten.index.Tensor: Critical Error in dispatcher:
Traceback (most recent call last):
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_core.py", line 480, in _add_nodes
_handle_call_function_node_with_lowering(
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_core.py", line 348, in _handle_call_function_node_with_lowering
onnx_function, message = _dispatching.dispatch(node, registry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_dispatching.py", line 326, in dispatch
overload, message = get_matching_overload(
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_dispatching.py", line 252, in get_matching_overload
first_tensor = _get_first_tensor_in_node_list(arg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_dispatching.py", line 180, in _get_first_tensor_in_node_list
if "val" in node.meta and isinstance(node.meta["val"], torch.Tensor):
^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'meta'
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 196, 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 619, 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 491, in _add_nodes
raise errors.OnnxConversionError(
torch_onnx.errors.OnnxConversionError: Error when translating node %index : [num_users=1] = call_function[target=torch.ops.aten.index.Tensor](args = (%slice_2, [None, %lift_fresh_copy, None, %lift_fresh_copy_1, %lift_fresh_copy_2]), kwargs = {}). See the stack trace for more information.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_analysis.py", line 213, in analyze
onnx_function, message = _dispatching.dispatch(node, registry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_dispatching.py", line 326, in dispatch
overload, message = get_matching_overload(
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_dispatching.py", line 252, in get_matching_overload
first_tensor = _get_first_tensor_in_node_list(arg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_dispatching.py", line 180, in _get_first_tensor_in_node_list
if "val" in node.meta and isinstance(node.meta["val"], torch.Tensor):
^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'meta'
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, 4, 5, 6, 7]), dtype=torch.float32, requires_grad=False, stride=(840, 210, 42, 7, 1), memory_format=torch.contiguous_format, is_quantized=False, qparams={})
Outputs:
index
:TensorMetadata(shape=torch.Size([2, 2, 3, 5]), dtype=torch.float32, requires_grad=False, stride=(30, 15, 5, 1), memory_format=torch.contiguous_format, is_quantized=False, qparams={})
The FX graph has 11 nodes in total. Number of FX nodes per op:
placeholder
: 4call_function
: 6output
: 1Of the call_function nodes, the counts of operators used are:
aten.lift_fresh_copy.default
: 3aten.slice.Tensor
: 2aten.index.Tensor
: 1ONNX Conversion Information
The model contains operators the dispatcher could not find registered ONNX decompositions for. This may be due to missing implementations, decompositions not registered correctly, or a bug in the dispatcher.
Errors grouped by operator:
aten.index.Tensor
: Critical Error in dispatcher:. Example node:
%index : [num_users=1] = call_function[target=torch.ops.aten.index.Tensor](args = (%slice_2, [None, %lift_fresh_copy, None, %lift_fresh_copy_1, %lift_fresh_copy_2]), kwargs = {})
. All nodes:[index]