Found at least two devices, cuda:-2 and cuda:0!

terminate called after throwing an instance of 'std::runtime_error'
  what():  The following operation failed in the TorchScript interpreter.

...

RuntimeError: Expected all tensors to be on the same device, 
but found at least two devices, cuda:-2 and cuda:0! 
(when checking argument for argument weight in method wrapper__cudnn_convolution)

Does anyone know how to deal with this error?
I only have one GPU and made sure to send both the model and input tensors to the same device.
What does a negative device (-2) even mean?

2 Likes

I got a similar error as yours. Have you figured this out?