RuntimeError: CUDA error: device-side assert triggered

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)