torch.onnx.testing
Utilities to aid in testing exported ONNX models.
- torch.onnx.testing.assert_onnx_program(program, *, rtol=None, atol=None, args=None, kwargs=None, ,
Utilities to aid in testing exported ONNX models.
Assert that the ONNX model produces the same output as the PyTorch ExportedProgram.
program (_onnx_program.ONNXProgram) – The ONNXProgram to verify.
rtol (float | None) – Relative tolerance.
atol (float | None) – Absolute tolerance.
args (tuple[Any, ...] | None) – The positional arguments to pass to the program. If None, the default example inputs in the ExportedProgram will be used.
kwargs (dict[str, Any] | None) – The keyword arguments to pass to the program. If None, the default example inputs in the ExportedProgram will be used.
strategy (str | None) – Assert the capture strategy used to export the program. Values can be class names like “TorchExportNonStrictStrategy”. If None, the strategy is not asserted.
backend (Literal['onnxruntime', 'reference']) – The backend to use for evaluating the ONNX program. Supported values are “onnxruntime” and “reference”.