`/home/lyh/Instance/AdelaiDet/onnx/export_onnx_v2.py:164: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert int(factor) == factor
/home/lyh/Instance/AdelaiDet/onnx/export_onnx_v2.py:166: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if factor == 1:
Traceback (most recent call last):
File "/home/lyh/Instance/AdelaiDet/onnx/export_onnx_v2.py", line 300, in
main()
File "/home/lyh/Instance/AdelaiDet/onnx/export_onnx_v2.py", line 293, in main
opset_version=11,
File "/opt/conda/lib/python3.7/site-packages/torch/onnx/init.py", line 280, in export
custom_opsets, enable_onnx_checker, use_external_data_format)
File "/opt/conda/lib/python3.7/site-packages/torch/onnx/utils.py", line 94, in export
use_external_data_format=use_external_data_format)
File "/opt/conda/lib/python3.7/site-packages/torch/onnx/utils.py", line 695, in _export
dynamic_axes=dynamic_axes)
File "/opt/conda/lib/python3.7/site-packages/torch/onnx/utils.py", line 487, in _model_to_graph
torch._C._jit_pass_onnx_assign_output_shape(graph, output_tensors, out_desc, _onnx_shape_inference)
RuntimeError: ArrayRef: invalid index Index = 21; Length = 21
I use the script as follows to convert pth to onnx.
but there is an error for it:
`/home/lyh/Instance/AdelaiDet/onnx/export_onnx_v2.py:164: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! assert int(factor) == factor /home/lyh/Instance/AdelaiDet/onnx/export_onnx_v2.py:166: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if factor == 1: Traceback (most recent call last): File "/home/lyh/Instance/AdelaiDet/onnx/export_onnx_v2.py", line 300, in
main()
File "/home/lyh/Instance/AdelaiDet/onnx/export_onnx_v2.py", line 293, in main
opset_version=11,
File "/opt/conda/lib/python3.7/site-packages/torch/onnx/init.py", line 280, in export
custom_opsets, enable_onnx_checker, use_external_data_format)
File "/opt/conda/lib/python3.7/site-packages/torch/onnx/utils.py", line 94, in export
use_external_data_format=use_external_data_format)
File "/opt/conda/lib/python3.7/site-packages/torch/onnx/utils.py", line 695, in _export
dynamic_axes=dynamic_axes)
File "/opt/conda/lib/python3.7/site-packages/torch/onnx/utils.py", line 487, in _model_to_graph
torch._C._jit_pass_onnx_assign_output_shape(graph, output_tensors, out_desc, _onnx_shape_inference)
RuntimeError: ArrayRef: invalid index Index = 21; Length = 21
Process finished with exit code 1 `