RuntimeError: cuda runtime error (59) THCReduceAll.cuh

Can anyone help?

IndexType = unsigned int, DstDim = 2, SrcDim = 2, IdxDim = -2]: block: [216,0,0], thread: [62,0,0] Assertion `srcIndex < srcSelectDimSize` failed.
/home/playma/Research/pytorch/torch/lib/THC/THCTensorIndex.cu:321: void indexSelectLargeIndex(TensorInfo<T, IndexType>, TensorInfo<T, IndexType>, TensorInfo<long, IndexType>, int, int, IndexType, IndexType, long) [with T = float, IndexType = unsigned int, DstDim = 2, SrcDim = 2, IdxDim = -2]: block: [216,0,0], thread: [63,0,0] Assertion `srcIndex < srcSelectDimSize` failed.
THCudaCheck FAIL file=/home/playma/Research/pytorch/torch/lib/THC/generated/../THCReduceAll.cuh line=334 error=59 : device-side assert triggered
Traceback (most recent call last):
  File "pretrain_discriminator.py", line 104, in <module>
    main()
  File "pretrain_discriminator.py", line 97, in main
    discriminator.train(train_loader, dis, args, DIS_EPOCHS, num_gpus)
  File "/home/playma/Research/code/cnn.py", line 86, in train
    corrects = (torch.max(logit, 1)[1].view(target.size()).data == target.data).sum()
RuntimeError: cuda runtime error (59) : device-side assert triggered at /home/playma/Research/pytorch/torch/lib/THC/generated/../THCReduceAll.cuh:334

Hi

Faced this problem too. Please check the output of your model to make sure that the dimension of the output matches the number of classes.

3 Likes