Export the PyTorch model to ONNX
Usetorch.onnx.export to convert the PyTorch model to ONNX format:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Convert a PyTorch model to LiteRT format for deployment on Qualcomm Dragonwing IoT platforms using the PyTorch → ONNX → TensorFlow → LiteRT conversion path.
torch.onnx.export to convert the PyTorch model to ONNX format:
import torch
model.eval()
dummy_input = torch.randn(1, 3, 224, 224)
torch.onnx.export(
model,
dummy_input,
"model.onnx",
opset_version=13,
input_names=["input"],
output_names=["output"],
do_constant_folding=True
)
Was this page helpful?
