TypeError: float() argument must be a string or a number, not '_NoValueType'

def imshow(img):
img = img / 2 + 0.5 # unnormalize
npimg = img.numpy()
plt.imshow(np.transpose(npimg, (1, 2, 0)))
plt.show()

随机获取训练图片

dataiter = iter(trainloader)
images, labels = dataiter.next()

显示图片

imshow(torchvision.utils.make_grid(images))

打印图片标签

print(' '.join('%5s' % classes[labels[j]] for j in range(4)))

float() argument must be a string or a number
报错的意思float(A),要求A是一个字符串数字或者数字,但是你的是空的,你在哪里用float转换数值的地方出问题了