in losses.py [0:0]
def forward(self, x, y):
"""Compute the beginning-intermediate feature of x, y and their MSE loss."""
if not x.is_contiguous():
x = x.contiguous()
if not y.is_contiguous():
y = y.contiguous()
x_vgg, y_vgg = self.vgg(x), self.vgg(y)
loss = 0
for i in range(len(x_vgg)):
loss += self.weights[i] * self.criterion(x_vgg[i], y_vgg[i].detach())
return loss