pytorch-retinanet icon indicating copy to clipboard operation
pytorch-retinanet copied to clipboard

RuntimeError: Expected object of backend CUDA but got backend CPU for ...

Open starhiking opened this issue 5 years ago • 4 comments

The original code doesn't consider the gpu situation for loss, and will lead to the problem: RuntimeError: Expected object of backend CUDA but got backend CPU for ...

original code: https://github.com/yhenon/pytorch-retinanet/blob/ef2c16f4ad66b652b836be36465ee63c978f3194/retinanet/losses.py#L64

change:

regression_losses.append(torch.tensor(0).float().cuda())

starhiking avatar Jul 14 '20 13:07 starhiking

It really works, but why?

LIYHUI avatar Sep 25 '20 07:09 LIYHUI

It really works, but why?

CUDA is avaliable for that situation

starhiking avatar Sep 25 '20 07:09 starhiking

It really works, but why?

CUDA is avaliable for that situation

thank you, I am not familiar with that, but I understand it now.

LIYHUI avatar Sep 25 '20 07:09 LIYHUI

Was a PR created for this ? This really fixes an error in the code.

wvalcke avatar Nov 06 '20 18:11 wvalcke