pytorch中运行分类或者多类分割任务时,报错:
/pytorch/aten/src/THCUNN/SpatialClassNLLCriterion.cu:103: void cunn_SpatialClassNLLCriterion_updateOutput_kernel(T *, T *, T *, long *, T *, int, int, int, int, int, long) [with T = float, AccumT = float]: block: [34,0,0], thread: [853,0,0] Assertion `t >= 0 && t < n_classes` failed.
是因为
在算loss时计算机发现类别数目不对!
本文探讨了在使用PyTorch进行分类或多类分割任务时遇到的常见错误:'Assertion `t>=0&&t<n_classes` failed.'。详细解释了此错误是因为在计算损失函数时,计算机检测到类别数不匹配的问题。
10万+





