TencentARC/VQFR

How to convert model to onnx?

Opened this issue · 0 comments

When I convert torch model to onnx model, the following error occurred:
main()
File "convert_to_onnx.py", line 118, in main
torch.onnx.export(model, x, onnx_model_path,
File "\Python\Python310\site-packages\torch\onnx\utils.py", line 506, in export
_export(
File "\Python\Python310\site-packages\torch\onnx\utils.py", line 1548, in _export
graph, params_dict, torch_out = _model_to_graph(
File "\Python\Python310\site-packages\torch\onnx\utils.py", line 1117, in _model_to_graph
graph = _optimize_graph(
File "\Python\Python310\site-packages\torch\onnx\utils.py", line 665, in _optimize_graph
graph = _C._jit_pass_onnx(graph, operator_export_type)
File "\Python\Python310\site-packages\torch\onnx\utils.py", line 1891, in _run_symbolic_function
return symbolic_fn(graph_context, *inputs, **attrs)
File "\Python\Python310\site-packages\torch\onnx\symbolic_helper.py", line 306, in wrapper
return fn(g, *args, **kwargs)
File "\Python\Python310\site-packages\deform_conv2d_onnx_exporter.py", line 655, in deform_conv2d
dcn_params = create_dcn_params(input, weight, offset, mask, bias,
File "\Python\Python310\site-packages\deform_conv2d_onnx_exporter.py", line 568, in create_dcn_params
in_h = get_tensor_dim_size(input, 2) + 2 * (pad_h + additional_pad_h)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
(Occurred when translating deform_conv2d).

How to solve this problem, thank you!