Skip to content

Instantly share code, notes, and snippets.

@ksivaman
Created August 9, 2019 23:31
Show Gist options
  • Save ksivaman/b3bc45188d0a39e01335167bf98eb1ad to your computer and use it in GitHub Desktop.
Save ksivaman/b3bc45188d0a39e01335167bf98eb1ad to your computer and use it in GitHub Desktop.
initialize pretrained model for neural style transfer
vgg = models.vgg19(pretrained=True).features
# freeze VGG params to avoid chanhe
for param in vgg.parameters():
param.requires_grad_(False)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
vgg.to(device)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment