LoginSignup
1
0

More than 3 years have passed since last update.

【Pytorch】RuntimeError: CUDA error: an illegal memory access was encountered

Posted at

errorの内容

pytorchでCrossEntropyLossをlossの計算に使った場合errorが出る。

RuntimeError: CUDA error: an illegal memory access was encountered

原因

pytorchのimplementationミスだそうです。
labelが[0 ~ NUM_CLASS-1]の範囲を超える事によるerror
今回はクラスに分類されない物体を255と設定していたのでエラーとなりました。

解決策

・labelを[0 ~ NUM_CLASS-1]の中で設定する

or

・pytorch 1.5.1以上にupdateする

参考文献

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0