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

[Model Compression] Expand export_model arguments: dummy input and onnx opset_version #3968

Merged
merged 5 commits into from Jul 26, 2021

Conversation

xiaowu0162
Copy link
Contributor

@xiaowu0162 xiaowu0162 commented Jul 21, 2021

Fix #3964.

@xiaowu0162
Copy link
Contributor Author

Ready for review @J-shang @QuanluZhang

device = torch.device('cpu')
input_data = torch.Tensor(*input_shape).to(device)
else:
input_data = dummy_input
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if user both set dummy_input and device

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think device should be ignored in that case. Have updated the docstring.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommand we also input_data = dummy_input.to(device), or this may confuse user, if user also set device but we ignore it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I think this operation may fail when e.g., dummy_input is a tuple

@J-shang J-shang requested a review from ultmaster July 21, 2021 07:15
@QuanluZhang QuanluZhang merged commit 68818a3 into microsoft:master Jul 26, 2021
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

Successfully merging this pull request may close these issues.

Use higher opset_version when exporting ONNX models
4 participants