【Pytorch】RuntimeError: CUDA error: an illegal memory access was encountered
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する
参考文献
Author And Source
この問題について(【Pytorch】RuntimeError: CUDA error: an illegal memory access was encountered), 我々は、より多くの情報をここで見つけました https://qiita.com/minh33/items/474e8288a41715e45e82著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .