def __init__(self, img_dim, embed_size, image_norm=True, cnn_type='vgg19', finetune=False):

        """Load pretrained VGG19 and replace top fc layer."""
        super(EncoderImageFull, self).__init__()
        self.embed_size = embed_size
        self.image_norm = image_norm

        # Replace the last fully connected layer of CNN with a new one
        if cnn_type.startswith('vgg'):
            self.cnn = models.vgg19(pretrained=True)
            self.cnn.classifier = nn.Sequential(*list(self.cnn.classifier.children())[:-1])

            for param in self.cnn.parameters():
                param.requires_grad = finetune

            self.fc = nn.Linear(4096, 1024)

        elif cnn_type.startswith('resnet'):
            self.cnn = models.resnet152(pretrained=True)
            self.cnn = nn.Sequential(*list(self.cnn.children())[:-1])
            for param in self.cnn.parameters():
                param.requires_grad = finetune

            self.fc = nn.Linear(2048, 1024)

        self.init_weights()
Load pretrained VGG19 and replace top fc layer.
torchmm/models/retrieval/layers/img_enc.py