RuntimeError: CUDA error: device-side assert triggered
/opt/conda/conda-bld/pytorch_1549628766161/work/aten/src/THCUNN/ClassNLLCriterion.cu:105: void cunn_ClassNLLCriterion_updateOutput_kernel(Dtype *, Dtype *, Dtype *, long *, Dtype *, int, int, int, int, long) [with Dtype = float, Acctype = float]: block: [0,0,0], thread: [7,0,0] Assertion `t >= 0 && t < n_classes` failed.
使用pytorch的时候报这个错误说明你label中有些指不在[0, num_classes), 区间左闭右开。比如类别数num_class=3, 你的label出现了-1或者3, 4, 5等!
参考:
https://blog.csdn.net/weixin_37142859/article/details/93844144