📜  以 ONNX 运行时格式导出 PyTorch 模型 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:50.204000             🧑  作者: Mango

代码示例1
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.