torch报错

报错:
torch.DoubleTensor but found a type torch.FloatTensor for sequence element 36 in sequence argument at position #1 ‘tensors’

解决:
此处发现是load_data的时候出了问题
生成了valDataloader后
len(valDataloader)发现是1,因此在iter.next()到第二个就报错。
最终的问题在于输入默认参数设置,把图片尺寸和batch调整就好了

parser.add_argument('--batchSize', type=int, default=1, help='input batch size')
parser.add_argument('--valBatchSize', type=int, default=1, help='input batch size')
parser.add_argument('--originalSize', type=int,
  default=512, help='the height / width of the original input image')
parser.add_argument('--imageSize', type=int,
  default=512, help='the height / width of the cropped input image to network')

猜你喜欢

转载自blog.csdn.net/qq_35608277/article/details/85333567