Created
January 8, 2019 22:21
-
-
Save LiamHz/05aacc355589e4047f6ad4e1e2dddc36 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
# Get the "features" portion of VGG19 | |
# The classifier portion is not needed for style transfer | |
vgg = models.vgg19(pretrained=True).features | |
# Freeze all VGG parameters | |
# Since only activations are measured for each conv layer | |
# Network weights aren't modified | |
for param in vgg.parameters(): | |
param.requires_grad_(False) | |
# Move the model to GPU, if available | |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
vgg.to(device) | |
print(vgg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment