Skip to content

Instantly share code, notes, and snippets.

@Icemole
Created June 26, 2023 15:19
Show Gist options
  • Save Icemole/38e03bc2bb0e96d8bc3423b7d21511aa to your computer and use it in GitHub Desktop.
Save Icemole/38e03bc2bb0e96d8bc3423b7d21511aa to your computer and use it in GitHub Desktop.
import torch
class DummyModel(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return torch.full([x], 0)
dummy_model = DummyModel()
dummy_data = torch.tensor(1, dtype=torch.int32)
torch.onnx.export(dummy_model, (dummy_data,), f="my_filename.onnx")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment