Last active
November 14, 2017 16:41
-
-
Save tuzhucheng/0c39850b138225791752d0e336381d8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch.onnx | |
from torch.autograd import Variable | |
import torch.nn as nn | |
inp = Variable(torch.LongTensor([1,2,3])) | |
class MyModel(nn.Module): | |
def __init__(self): | |
super(MyModel, self).__init__() | |
self.embedding = nn.Embedding(100, 300) | |
def forward(self, x): | |
out = self.embedding(x) | |
return out | |
model = MyModel() | |
out = model(inp) | |
torch.onnx.export(model, inp, 'embedding_only.onnx', verbose=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment