Using cross_entropy and cuda runtime error (59) : device-side assert triggered

hi
i have a dataset that each image has a ground truth image .each ground truth image has 3 labels ,label1 is background label 2 is organ A and label 3 is organ B.
when i am using cross_entropy as loss function

criterion =cross=nn.functional.cross_entropy

this error occure
( I ran my script with CUDA_LAUNCH_BLOCKING=1 and the error log is as follows )

Could you please help me to figure out what is the problem?

Try to run on CPU; that should give a clearer message. The device-side assert gets triggered in NLLLoss2d when the inputs are not in the correct format.

1 Like

thank you for your reply, i’m now trying to run on CPU but it runs on GPU ,even i removed all .cuda option of parameters.I don’t know how disable GPU! And also i removed model.cuda()