Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

导出onnx报错 #9

Closed
kongxm889 opened this issue Dec 16, 2021 · 1 comment
Closed

导出onnx报错 #9

kongxm889 opened this issue Dec 16, 2021 · 1 comment

Comments

@kongxm889
Copy link

运行命令:
python onnx_exporter_solov2.py ../configs/solov2/solov2_r101_fpn_8gpu_3x-kxm.py ../work_dirs/SOLOv2.onnx --checkpoint ../work_dirs/solov2_release_r101_fpn_8gpu_3x/epoch_3042.pth --shape 1333 800

运行结果:
File "onnx_exporter_solov2.py", line 222, in
convert2onnx(args, dummy_input)
File "onnx_exporter_solov2.py", line 97, in convert2onnx
torch.onnx.export(model, dummy_input, args.out, input_names=input_names, output_names=output_names, verbose=True, opset_version=11)
File "/home/kxm/.conda/envs/solov2onnx/lib/python3.7/site-packages/torch/onnx/init.py", line 148, in export
strip_doc_string, dynamic_axes, keep_initializers_as_inputs)
File "/home/kxm/.conda/envs/solov2onnx/lib/python3.7/site-packages/torch/onnx/utils.py", line 66, in export
dynamic_axes=dynamic_axes, keep_initializers_as_inputs=keep_initializers_as_inputs)
File "/home/kxm/.conda/envs/solov2onnx/lib/python3.7/site-packages/torch/onnx/utils.py", line 416, in _export
fixed_batch_size=fixed_batch_size)
File "/home/kxm/.conda/envs/solov2onnx/lib/python3.7/site-packages/torch/onnx/utils.py", line 296, in _model_to_graph
fixed_batch_size=fixed_batch_size, params_dict=params_dict)
File "/home/kxm/.conda/envs/solov2onnx/lib/python3.7/site-packages/torch/onnx/utils.py", line 135, in _optimize_graph
graph = torch._C._jit_pass_onnx(graph, operator_export_type)
File "/home/kxm/.conda/envs/solov2onnx/lib/python3.7/site-packages/torch/onnx/init.py", line 179, in _run_symbolic_function
return utils._run_symbolic_function(*args, **kwargs)
File "/home/kxm/.conda/envs/solov2onnx/lib/python3.7/site-packages/torch/onnx/utils.py", line 657, in run_symbolic_function
return op_fn(g, *inputs, **attrs)
File "/home/kxm/.conda/envs/solov2onnx/lib/python3.7/site-packages/torch/onnx/symbolic_opset11.py", line 424, in linspace
steps
= sym_help._get_const(steps, 'i', 'steps')
File "/home/kxm/.conda/envs/solov2onnx/lib/python3.7/site-packages/torch/onnx/symbolic_helper.py", line 105, in _get_const
raise RuntimeError("ONNX symbolic expected a constant value of the {} argument, got {}".format(arg_name, value))
RuntimeError: ONNX symbolic expected a constant value of the steps argument, got 2719 defined in (%2719 : Long() = onnx::Gather[axis=0](%2716, %2718) # /home/kxm/SOLOv2.tensorRT/mmdet/models/anchor_heads/solov2_head.py:195:0 )

@ShkarupaDC
Copy link

@kongxm889, how did you fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants