[881]內存不足RuntimeError: CUDA out of memory. Tried to allocate 16.00 MiB (GPU 0; 2.00 GiB total cap...

原因一:找到錯誤點,增加以下語句: with torch.no_grad(): outputs = Net_(inputs) —錯誤代碼的位置。 原因二:GPU沒有選對 os.environ[「CUDA_VISIBLE_DEVICES」] = 「0, 2, 3」 查看性能,發現nVidia的只有GPU1,所以改成如下: os.environ[「CUDA_VISIBLE_DEVICES」] = 「0
相關文章
相關標籤/搜索