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, onnx, #223

Open
yyyyyxie opened this issue Jun 6, 2024 · 1 comment
Open

ONNX, onnx, #223

yyyyyxie opened this issue Jun 6, 2024 · 1 comment

Comments

@yyyyyxie
Copy link

yyyyyxie commented Jun 6, 2024

It seems that I can only export ONNX with a fixed input size. I hope to set the width and height as dynamic axes. However, after setting, the exported ONNX can still only use the original width and height as the unique input shape.
image

@yyyyyxie
Copy link
Author

yyyyyxie commented Jun 6, 2024

If I use inputs of different sizes, it will throw an error similar to the one shown in the image. I've spent a lot of time and it seems that I haven't solved this problem.

Code:
dynamic = {'inputs': {2: 'h', 3: 'w'}, 'outputs': {2: 'h', 3: 'w'}}
torch.onnx.export(model, (img,), output_path, verbose=False,
opset_version=17, input_names=['inputs'], output_names=['outputs'], dynamic_axes=dynamic)

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