Get_device is not implemented for type torch.FloatTensor

I am getting the following error of doing a forward pass on my model

  File "/media/newDrive/rishabh/anaconda3/lib/python3.6/site-packages/torch/nn/modules/", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/media/newDrive/rishabh/anaconda3/lib/python3.6/site-packages/torch/nn/modules/", line 49, in forward or not self.track_running_stats, self.momentum, self.eps)
  File "/media/newDrive/rishabh/anaconda3/lib/python3.6/site-packages/torch/nn/", line 1194, in batch_norm
    training, momentum, eps, torch.backends.cudnn.enabled
RuntimeError: get_device is not implemented for type torch.FloatTensor

Can someone explain how to fix this and why is this happening??

It looks like some tensors are on the CPU, while the code would like to call a function on a tensor which was pushed to the GPU.
Could you post a small code snippet reproducing this error?

Just found the bug, model was in CPU (so stupid of me!!)
Also the error message could be improved maybe, I though I was doing something wrong with autograd!


The error message is indeed misleading.
Thanks for reporting!