報錯文章來源:http://www.zghlxwxcb.cn/news/detail-743496.html
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 330.00 MiB (GPU 0; 2.00 GiB total capacity; 1006.56 MiB already allocated; 144.51 MiB free; 1.02 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
做深度學(xué)習(xí)相關(guān)的實(shí)驗(yàn),可以看到我的顯卡內(nèi)存很?。蘖?,不過我有時候是在別的電腦上做的,那個電腦比這個好用),網(wǎng)上搜到的說的 max_split_size_mb:128 這個方法我貼到我代碼上之后沒有效果。
因?yàn)槲以谶@個電腦上做的是主實(shí)驗(yàn)后面的一些對比實(shí)驗(yàn),也就是代碼中很多張量很多數(shù)據(jù)是不需要的。
所以抖了個機(jī)靈,把不需要的數(shù)據(jù)全都注釋掉,代碼正常運(yùn)行,對比實(shí)驗(yàn)數(shù)據(jù)跑出來了耶!文章來源地址http://www.zghlxwxcb.cn/news/detail-743496.html
到了這里,關(guān)于Pycharm報錯torch.cuda.OutOfMemoryError: CUDA out of memory.的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!