Gpu is almost not being used while training but data and model are on device

Ow, sorry, I do not know why I said optim.cuda() so strictly! thanks @harsha_g for pointing out to. I meant loss functions but still it won’t make any differences because there is no parameter in cross entropy.
Also, did you try to remove Variable from your code and sending in/out to GPU using .cuda()?

Sending model and input/output tensors to cuda is enough. Can you check that after sending input/output to cuda, they are really on cuda? .device will help.

See this thread, it has a lot of good responses to different issues. [SOLVED] Make Sure That Pytorch Using GPU To Compute

1 Like