ONNX Backend for TorchDynamo#
创建于: 2025 年 6 月 10 日 | 最后更新于: 2025 年 6 月 10 日
For a quick overview of torch.compiler
, see torch.compiler.
警告
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.示例
# 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") ...
- 返回类型