RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0.
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 756 and 1008 in dimension 2
原因:输入的图像数据的维度不完全一样(数据集图像大小不一)。
解决方法: transforms.Compose([
transforms.RandomResizedCrop(224),# 随机裁剪])
图片: