you should check the code on cpu and see what is the actual error.
but i guess it’s becuase of target dtype.
you can try .long().cuda() on all of the cross entroypy loss targets.
by the way you’re creating your loss functions in you the training loop.
it’s better to move it out