but why still get error, the code is as follow:
loader = transforms.Compose([ transforms.Scale(311),
transforms.CenterCrop(299), transforms.ToTensor()])
def image_loader(image_name):
“”“load image, returns cuda tensor”""
image = Image.open(image_name)
image = loader(image).float()
image = Variable(image, requires_grad=True)
image = image.unsqueeze(0)  #this is for VGG, may not be needed for ResNet
return image
# return image.cuda()  #assumes that you’re using GPU
image = image_loader(‘test.jpg’)
print(image.shape)
model = models.inception_v3(pretrained=True)
model(image)
the image shape is torch size [1,3,299,299]
but get error:
Expected more than 1 value per channel when training, got input size [1, 768, 1, 1]