Pytorch RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton

报错信息:Pytorch RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0

解决方法:

img = Image.open("../flower_data/tulip.png")

改为

img = Image.open("../flower_data/tulip.png").convert('RGB')

你可能感兴趣的:(pytorch)