You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the great work. I'm trying to convert this model into onnx, but have met a few issues.
The mv and dot operator used by PyTorch's spectral_norm was one of them. Following onnx/onnx#3006 (comment) I coverted them to matmul in my own implementation of spectral_norm and the issue went away.
Now it's complaining:
Traceback (most recent call last):
out = torch.onnx.export(model, input_dict["image"], "model.onnx", verbose=False, opset_version=11,
File "/usr/local/lib/python3.8/dist-packages/torch/onnx/__init__.py", line 271, in export
return utils.export(model, args, f, export_params, verbose, training,
File "/usr/local/lib/python3.8/dist-packages/torch/onnx/utils.py", line 88, in export
_export(model, args, f, export_params, verbose, training, input_names, output_names,
File "/usr/local/lib/python3.8/dist-packages/torch/onnx/utils.py", line 694, in _export
_model_to_graph(model, args, verbose, input_names,
File "/usr/local/lib/python3.8/dist-packages/torch/onnx/utils.py", line 463, in _model_to_graph
graph = _optimize_graph(graph, operator_export_type,
File "/usr/local/lib/python3.8/dist-packages/torch/onnx/utils.py", line 206, in _optimize_graph
graph = torch._C._jit_pass_onnx(graph, operator_export_type)
File "/usr/local/lib/python3.8/dist-packages/torch/onnx/__init__.py", line 309, in _run_symbolic_function
return utils._run_symbolic_function(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/torch/onnx/utils.py", line 997, in _run_symbolic_function
return symbolic_fn(g, *inputs, **attrs)
File "/usr/local/lib/python3.8/dist-packages/torch/onnx/symbolic_helper.py", line 148, in wrapper
return fn(g, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/torch/onnx/symbolic_opset9.py", line 1285, in batch_norm
if weight is None or sym_help._is_none(weight):
RuntimeError: Unsupported: ONNX export of batch_norm for unknown channel size.
Not sure that this solution is right, I downgraded torch to 1.7 and then model converted to onnx. Looks like some bug on torch to onnx conversion side that upsample in new versions to produce dynamic shapes which lead to error for batch norms
Hello,
Thanks for the great work. I'm trying to convert this model into onnx, but have met a few issues.
The
mv
anddot
operator used by PyTorch'sspectral_norm
was one of them. Following onnx/onnx#3006 (comment) I coverted them tomatmul
in my own implementation ofspectral_norm
and the issue went away.Now it's complaining:
The code to convert this is:
I printed out the graph
g
from https://github.com/pytorch/pytorch/blob/e56d3b023818f54553f2dc5d30b6b7aaf6b6a325/torch/onnx/symbolic_opset9.py#L1337Float(*, *, *, *
stood out to me but I'm not sure how to interpret this.The text was updated successfully, but these errors were encountered: