C:\cb\pytorch_1000000000000\work\aten\src\ATen\native\cuda\NLLLoss2d.cu:103: block: [3,0,0], thread: [385,0,0] Assertion `t >= 0 && t < n_classes` failed.
Traceback (most recent call last):
File "c:\Users\裴沐阳\Desktop\裴沐阳毕设相关\毕设--图像分割\UNet\U-Net.py", line 355, in <module>
history = fit(epoch, model, train_loader, val_loader, criterion, optimizer, sched)
File "c:\Users\裴沐阳\Desktop\裴沐阳毕设相关\毕设--图像分割\UNet\U-Net.py", line 241, in fit
loss = criterion(output,mask)
File "D:\python\python3.8\envs\pmyixq\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "D:\python\python3.8\envs\pmyixq\lib\site-packages\torch\nn\modules\loss.py", line 1164, in forward
return F.cross_entropy(input, target, weight=self.weight,
File "D:\python\python3.8\envs\pmyixq\lib\site-packages\torch\nn\functional.py", line 3014, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
RuntimeError: CUDA error: device-side assert triggered