leongatys / PytorchNeuralStyleTransfer

Implementation of Neural Style Transfer in Pytorch
MIT License
421 stars 103 forks source link

loss = sum(layer_losses) #16

Open 0x54daydreamer opened 2 years ago

0x54daydreamer commented 2 years ago

Hello, I am new to pytorch and this scene in general, but when I run the code I get an error;torch.sum() Use tensor.detach().numpy() instead.

I am not familiar with how to detach or couldnt find an example of detaching each tensor on the list. Is the following equivalent code? : for elem in layer_losses[1:]: loss += elem

jianlgler commented 2 years ago

Same problem here

ankit7699 commented 1 year ago

loss = torch.sum(torch.stack(layer_losses))