Guest User

Untitled

a guest
Aug 10th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. import torch
  2. import torch.nn as nn
  3.  
  4. class Model(nn.Module):
  5. def __init__(self):
  6. super(Model, self).__init__()
  7. self.linear = nn.Linear(1,1)
  8.  
  9. def forward(self, x):
  10. y = self.linear(x)
  11. return y
  12.  
  13. x = torch.zeros(1)
  14.  
  15. model = Model()
  16.  
  17. trace = torch.jit.trace(x)(model)
  18.  
  19. trace.save('trace.pt')
Add Comment
Please, Sign In to add comment