主要原因是在数据集加载过程中加入了batch_size,将tensor变为了四维。 print(img.shape) img1 = img[0] print(img1.shape) 直接将其转为三维即可