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失败 #31

Open
t973288913 opened this issue Oct 17, 2023 · 0 comments
Open

导出onnx失败 #31

t973288913 opened this issue Oct 17, 2023 · 0 comments

Comments

@t973288913
Copy link

C:\Users\97328.conda\envs\torch\python.exe "E:\A_Deep learning model\pspnet-txx-yck\predict.py"
E:\A_Deep learning model\pspnet-txx-yck\logs\lr0.0001\best_epoch_weights.pth model, and classes loaded.
Configurations:

| keys | values|

| model_path | E:\A_Deep learning model\pspnet-txx-yck\logs\lr0.0001\best_epoch_weights.pth|
| num_classes | 2|
| backbone | mobilenet|
| input_shape | [512, 512]|
| downsample_factor | 16|
| mix_type | 0|
| cuda | True|

E:\A_Deep learning model\pspnet-txx-yck\logs\lr0.0001\best_epoch_weights.pth model, and classes loaded.
Starting export with onnx 1.14.1.
============= Diagnostic Run torch.onnx.export version 2.0.0+cu118 =============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================

Traceback (most recent call last):
File "E:\A_Deep learning model\pspnet-txx-yck\predict.py", line 163, in
pspnet.convert_to_onnx(simplify, onnx_save_path)
File "E:\A_Deep learning model\pspnet-txx-yck\pspnet.py", line 277, in convert_to_onnx
torch.onnx.export(self.net,
File "C:\Users\97328.conda\envs\torch\lib\site-packages\torch\onnx\utils.py", line 506, in export
_export(
File "C:\Users\97328.conda\envs\torch\lib\site-packages\torch\onnx\utils.py", line 1548, in _export
graph, params_dict, torch_out = _model_to_graph(
File "C:\Users\97328.conda\envs\torch\lib\site-packages\torch\onnx\utils.py", line 1117, in _model_to_graph
graph = _optimize_graph(
File "C:\Users\97328.conda\envs\torch\lib\site-packages\torch\onnx\utils.py", line 665, in _optimize_graph
graph = _C._jit_pass_onnx(graph, operator_export_type)
File "C:\Users\97328.conda\envs\torch\lib\site-packages\torch\onnx\utils.py", line 1891, in _run_symbolic_function
return symbolic_fn(graph_context, *inputs, **attrs)
File "C:\Users\97328.conda\envs\torch\lib\site-packages\torch\onnx\symbolic_helper.py", line 392, in wrapper
return fn(g, *args, **kwargs)
File "C:\Users\97328.conda\envs\torch\lib\site-packages\torch\onnx\symbolic_opset9.py", line 1836, in symbolic_fn
return symbolic_helper._unimplemented(
File "C:\Users\97328.conda\envs\torch\lib\site-packages\torch\onnx\symbolic_helper.py", line 607, in _unimplemented
_onnx_unsupported(f"{op}, {msg}", value)
File "C:\Users\97328.conda\envs\torch\lib\site-packages\torch\onnx\symbolic_helper.py", line 618, in _onnx_unsupported
raise errors.SymbolicValueError(
torch.onnx.errors.SymbolicValueError: Unsupported: ONNX export of operator adaptive_avg_pool2d, output size that are not factor of input size. Please feel free to request support or submit a pull request on PyTorch GitHub: https://github.com/pytorch/pytorch/issues [Caused by the value '622 defined in (%622 : Long(2, strides=[1], device=cpu) = onnx::Constantvalue= 3 3 [ CPULongType{2} ]
)' (type 'Tensor') in the TorchScript graph. The containing node has kind 'onnx::Constant'.]

Inputs:
    Empty
Outputs:
    #0: 622 defined in (%622 : Long(2, strides=[1], device=cpu) = onnx::Constant[value= 3  3 [ CPULongType{2} ]]()
)  (type 'Tensor')

进程已结束,退出代码1

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

1 participant