Answers for "export PyTorch model in the ONNX Runtime format"

1

export PyTorch model in the ONNX Runtime format

dummy_input = torch.randn(1, 3, 224, 224, device='cuda')
onnx_path =  "./model.onnx"
torch.onnx.export(learn.model, dummy_input, onnx_path, verbose=False)

# The output will be the model written to a file called model.onnx.
Posted by: Guest on June-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language