Hi,
THe import tant lines here are just before the stack trace:
/pytorch/aten/src/THCUNN/ClassNLLCriterion.cu:108: cunn_ClassNLLCriterion_updateOutput_kernel: block: [0,0,0], thread: [0,0,0] Assertion `t >= 0 && t < n_classes` failed.

Basically, in the nll class, you give something that is not between 0 and n_classes.
So I guess one of the labels you give to your criterion does not have a valid value.
Note that running the same code on CPU will give you a more user friendly error message.