pytorch training model training with gpu loss function does not need to migrate to the gpu

Pytorch during training, when the input data tensor, and the model needs to .cuda, but in doing loss function when you do not need to Loss Function is set to form a cuda, because the loss of data has been sent to the type of cuda the loss will be calculated directly in it.

Published 36 original articles · won praise 11 · views 6531

Guess you like

Origin blog.csdn.net/t20134297/article/details/104937971