norm_layer(input_tensor.float().to('cuda'))

File “/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py”, line 489, in call
result = self.forward(*input, **kwargs)
File “/anaconda3/lib/python3.7/site-packages/torch/nn/modules/normalization.py”, line 158, in forward
input, self.normalized_shape, self.weight, self.bias, self.eps)
File “/anaconda3/lib/python3.7/site-packages/torch/nn/functional.py”, line 1651, in layer_norm
torch.backends.cudnn.enabled)
RuntimeError: Expected object of backend CPU but got backend CUDA for argument #3 ‘tensor1’
I switch to a gpu environment, and find this error, it seems that self.weight got backend CUDA which is unexpected. I use this explicit call “input_tensor.float().to(‘cuda’)” to make sure input to be a cuda.FloatTensor
But it makes no difference.