How to use a loss function on GPU #6759
Unanswered
fishbotics
asked this question in
DDP / multi-GPU / multi-node
Replies: 1 comment 1 reply
-
You can make them buffers. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I have a loss function which is a callable instance of a class. The class itself has some state which is stored on the GPU. Basically the class has some tensors that it applies to project the network's output into some space before computing the loss in the projected subspace. Since these tensors need to live on the same device as the LightningModule, is there any special way to ensure this happens? I got rid of all my calls to
.to()
as specified in the docs, but now I'm not sure how to make sure this loss class is transferred to the correct device when the model is as well.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions