[I’m guessing here]
‘target’ is probably ‘labels’.   What type are your labels initially?
You could try specifying their type explicitly, using something like

tb_labels = batch[2].to(device, dtype = torch.float)

Try this link python - RuntimeError: expected scalar type Long but found Float - Stack Overflow 11