日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Debug Pytorch: RuntimeError: CUDA error: device-side assert triggered

發布時間:2025/3/12 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Debug Pytorch: RuntimeError: CUDA error: device-side assert triggered 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

報錯信息

RuntimeError: CUDA error: device-side assert triggered /pytorch/aten/src/THC/THCTensorScatterGather.cu:188: void THCudaTensor_scatterFillKernel(TensorInfo<Real, IndexType>, TensorInfo<long, IndexType>, Real, int, IndexType) [with IndexType = unsigned int, Real = float, Dims = -1]: block: [31,0,0], thread: [100,0,0] Assertion `indexValue >= 0 && indexValue < tensor.sizes[dim]` failed. /pytorch/aten/src/THC/THCTensorScatterGather.cu:188: void THCudaTensor_scatterFillKernel(TensorInfo<Real, IndexType>, TensorInfo<long, IndexType>, Real, int, IndexType) [with IndexType = unsigned int, Real = float, Dims = -1]: block: [30,0,0], thread: [162,0,0] Assertion `indexValue >= 0 && indexValue < tensor.sizes[dim]` failed. /pytorch/aten/src/THC/THCTensorScatterGather.cu:188: void THCudaTensor_scatterFillKernel(TensorInfo<Real, IndexType>, TensorInfo<long, IndexType>, Real, int, IndexType) [with IndexType = unsigned int, Real = float, Dims = -1]: block: [32,0,0], thread: [290,0,0] Assertion `indexValue >= 0 && indexValue < tensor.sizes[dim]` failed.

解決

  • 檢查label中是否有-1,或者label中有大于num_classes的數。label更新無誤后可解決問題

  • 其他解決方法,嘗試運行時加上:

  • CUDA_LAUNCH_BLOCKING=1 python train.py

    聯系方式

    公眾號搜索:YueTan

    總結

    以上是生活随笔為你收集整理的Debug Pytorch: RuntimeError: CUDA error: device-side assert triggered的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。