【发布时间】:2019-04-11 21:25:01
【问题描述】:
我不明白labels.size(0) 这行。我是 Pytorch 的新手,对数据结构很困惑。
correct = 0
total = 0
with torch.no_grad():
for data in testloader:
images, labels = data
outputs = net(images)
_, predicted = torch.max(outputs.data, 1)
total += labels.size(0)
correct += (predicted == labels).sum().item()
print('Accuracy of the network on the 10000 test images: %d %%' % (
100 * correct / total))`
【问题讨论】:
-
该代码的哪些部分导致了这种混乱?
标签: pytorch