Skip to content

Instantly share code, notes, and snippets.

@Hramchenko
Created June 24, 2020 17:05
import torch
from torchvision import models
model = models.resnet50(pretrained=True)
data = torch.rand(1, 3, 256, 256)
input_names = ["input"]
output_names = ["output"]
torch.onnx.export(model, data, "model.onnx", verbose=True, input_names=input_names, output_names=output_names, opset_version=11, export_params=True, keep_initializers_as_inputs=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment