我正在尝试使用Pytorch建立分段模型,并实现自定义的IoULoss def IoULoss(inputs, targets, smooth=1e-6): union = (inputs | targets).float().sum(1)
IoU = (intersection + smooth) / (union +RuntimeError: element 0 of tensors does not require grad and does not hav
我将批处理大小减为1,清空了cuda缓存,并删除了gc中的所有变量,但我仍然得到了以下错误:RuntimeError: CUDA out of memory.15.78 GiB total capacity; 14.31 GiB already allocated; 2.75 MiB free; 14.78 GiB reserved in total by PyTorchSee documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
有没有办法,我可以解决这个问题,而不