RuntimeError: Expected object of scalar type Double but got scalar type Float for argument #2 'weight'

It seems you have a typo in your code and are reusing the targets tensor in the actual loss calculation while the DataLoader loop returns inputs (used) and labels (unused), so I guess you might need to replace targets with labels.

1 Like