Created
March 20, 2020 03:37
-
-
Save aoirint/40b3ac5e08b36932fdd99663c2bb3bf9 to your computer and use it in GitHub Desktop.
torch jit test
This file contains hidden or 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 | |
import torchvision.models as M | |
model = M.resnet18(pretrained=True) | |
model.eval() | |
# model = M.resnet50(pretrained=True) | |
dummy = torch.randn((1, 3, 224, 224)) | |
trmodel = torch.jit.trace(model, dummy) | |
file = 'resnet18.pt' | |
trmodel.save(file) | |
# trmodel.save('resnet50.pt') | |
torch.jit.load(file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment