can you elaborate just  a bit, what does it means “out-of-bounds class” and what is the nll_loss (last one for curiosity), the sizes of each tensor were checked carefully, I’ll be happy for your help, because it’s seems that every step I’m getting this error , also in:
 targets = targets.to('cuda')

Edit, I checked again and it works on cpu with batch = 1, when batch > 1, I get some similar error:
“cur_target >= 0 && cur_target < n_classes”
One more thing, it crashes only after few steps… is this “hinting” about the problem.
Thanks.