target = target.float()
This solved my problem.
Inspired by:
https://discuss.pytorch.org/t/runtimeerror-expected-object-of-type-torch-longtensor-but-found-type-torch-floattensor/23289/5 90
I used it in the training loop like this:
inputs, labels = data
inputs = inputs.float()
labels = labels.float()
(You should try to fix the origin of the problem! I just do this because I first want it running before optimizing, so I will go back to fix this later to improve speed)