[ONNX] Expose the testing module (#162495)

* Created a new module `torch/onnx/testing.py` that exposes the `assert_onnx_program` function for testing exported ONNX models.
* Updated the ONNX documentation (`docs/source/onnx.md`) to include `onnx_testing` in the list of relevant modules.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/162495
Approved by: https://github.com/titaiwangms, https://github.com/xadupre
This commit is contained in:
Justin Chu
2025-09-10 01:40:20 +00:00
committed by PyTorch MergeBot
parent 878f59ef75
commit c66e58b7d0
3 changed files with 18 additions and 0 deletions

View File

@ -102,6 +102,7 @@ also be interested in reading our [development wiki](https://github.com/pytorch/
onnx_export
onnx_ops
onnx_verification
onnx_testing
```
### Deprecated APIs

View File

@ -0,0 +1,9 @@
# torch.onnx.testing
```{eval-rst}
.. automodule:: torch.onnx.testing
```
```{eval-rst}
.. autofunction:: torch.onnx.testing.assert_onnx_program
```

8
torch/onnx/testing.py Normal file
View File

@ -0,0 +1,8 @@
"""Utilities to aid in testing exported ONNX models."""
__all__ = ["assert_onnx_program"]
from torch.onnx._internal.exporter._testing import assert_onnx_program
assert_onnx_program.__module__ = "torch.onnx.testing"