Note
This page describes an internal API which is not intended to be used outside of the PyTorch codebase and can be modified or removed without notice.
ONNX Backend for TorchDynamo
For a quick overview of torch.compiler
, see torch.compiler.
Warning
The ONNX backend for torch.compile is a rapidly evolving beta technology.
- torch.onnx.is_onnxrt_backend_supported()[source]
Returns
True
if ONNX Runtime dependencies are installed and usable to support TorchDynamo backend integration;False
otherwise.Example:
# xdoctest: +REQUIRES(env:TORCH_DOCTEST_ONNX) >>> import torch >>> if torch.onnx.is_onnxrt_backend_supported(): ... @torch.compile(backend="onnxrt") ... def f(x): ... return x * x ... print(f(torch.randn(10))) ... else: ... print("pip install onnx onnxscript onnxruntime") ...
- Return type