Python utils.gram_matrix() Examples

The following are 2 code examples of utils.gram_matrix(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module utils , or try the search function .
Example #1
Source File: model.py    From Neural-Style-Transfer-pytorch with MIT License 5 votes vote down vote up
def __init__(self, target):
        super(SL, self).__init__()
        self.target = gram_matrix(target).detach() 
Example #2
Source File: model.py    From Neural-Style-Transfer-pytorch with MIT License 5 votes vote down vote up
def forward(self, input):
        G = gram_matrix(input)
        self.loss = F.mse_loss(G, self.target)
        return input

## Generating the 'Neural Style Transfer' Model