The problem is because you’re doing it on CPU. Here’s a reply on a similar problem from another post on pytorch forums. It should work if you dua a .cuda() and move everything to GPU.



Variable failed to wrap HalfTensor


Hi,
CPU half tensors do not actually exist.
Using cuda HalfTensors work as expected:


link - Variable failed to wrap HalfTensor