torch.onnx — PyTorch 1.10 documentation
https://pytorch.org/docs/stable/onnx.htmlThe call to torch.onnx.export runs the model once to trace its execution and then exports the traced model to the specified file: import torch import torchvision dummy_input = torch . randn ( 10 , 3 , 224 , 224 , device = "cuda" ) model = torchvision . models . alexnet ( pretrained = True ) . cuda () # Providing input and output names sets the display names for values # within the …