-
Notifications
You must be signed in to change notification settings - Fork 3.5k
to_onnx return ONNXProgram #20811
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
base: master
Are you sure you want to change the base?
to_onnx return ONNXProgram #20811
Changes from 3 commits
bde9614
a966c0b
e7342e3
3ee3ea9
bc81215
236f1a0
019125d
9f5e604
791d777
453e63f
acdf3c1
e046d27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,3 +167,13 @@ def to_numpy(tensor): | |
|
||
# compare ONNX Runtime and PyTorch results | ||
assert np.allclose(to_numpy(torch_out), ort_outs[0], rtol=1e-03, atol=1e-05) | ||
|
||
|
||
@RunIf(onnx=True, min_torch="2.7.0", dynamo=True, onnxscript=True) | ||
def test_model_return_type(): | ||
model = BoringModel() | ||
model.example_input_array = torch.randn((1, 32)) | ||
model.eval() | ||
|
||
ret = model.to_onnx(dynamo=True) | ||
assert isinstance(ret, torch.onnx.ONNXProgram) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think it would be worth adding a check that verifies the output of the exported ONNX model matches the PyTorch model’s output (within tolerance)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could use the existed test Thank you ~. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's technically correct, but since we've only one type, what do you think about
Optional["ONNXProgram"]
for readability?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I've changed it in the last commit. Thanks.