我把model和model.cuda()放在GPU上。如果我将一个大映像传递给model,它会分配GPU0的所有内存,然后在不分配任何GPU1内存的情况下引发CUDA out of memory错误。因为每个forward()只有一个图像,所以我不能使用这样的torch.nn.DataParallel东西来分割输入。
在将图像传递给model时,有没有办法使用GPU的所有内存?我使用Python3.7和Pytorch1.1。
我的代码: model = models.vgg16(pretrained=True)#.features[:].classifier[:4] # model.cuda() # send the model to GPU, DO NOT include this line if you haven'tTraceback (most recent call last):
File "/mnt/c/