Created
November 6, 2018 22:28
-
-
Save steerapi/114a33820146de68848e43b18016d8af to your computer and use it in GitHub Desktop.
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 | |
# An instance of your model. | |
model = torchvision.models.resnet18(pretrained=True) | |
# An example input you would normally provide to your model's forward() method. | |
example = torch.rand(1, 3, 224, 224) | |
# Use torch.jit.trace to generate a torch.jit.ScriptModule via tracing. | |
traced_script_module = torch.jit.trace(model, example) | |
traced_script_module.save("resnet18.pt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment