Julio:

RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #2 ‘target’ in call to _thnn_nll_loss_forward


As it says you should cast target tensor to type long.
It can be done like that
target = target.long()