问题解决:Volatile = now has no effect. Usewith torch.no_grad():instead.

运行代码时,对于以下内容:

for batch_size, image in enumerate(data_loader):
        image = Variable(image, volatile=True)

出现错误:

Volatile = now has no effect. Usewith torch.no_grad():instead.

解决方法很简单,如下:


for batch_size, image in enumerate(data_loader):
    with torch.no_grad():
        image = Variable(image)

就可以解决问题了~

你可能感兴趣的:(PyTorch框架学习,大杂烩计算机知识)