Native support in PyTorch
PyTorch includes support for ONNX through the torch.onnx APIs to simplify exporting your PyTorch model to the portable ONNX format. The ONNX Runtime team maintains these exporter APIs to ensure a high level of compatibility with PyTorch models.
import torch
torch.onnx.export(
model,
inputs,
"model.onnx")