Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loss = sum(layer_losses) #16

Open
0x54daydreamer opened this issue May 4, 2022 · 2 comments
Open

loss = sum(layer_losses) #16

0x54daydreamer opened this issue May 4, 2022 · 2 comments

Comments

@0x54daydreamer
Copy link

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
Copy link

Same problem here

@ankit7699
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants