Expected more than 1 value
Value error: Expected more than 1 value per channel when training, got input size torch.Size([1, 512])
原因:
模型中用了batchnomolization,训练中用batch训练的时候,应该是有单数,比如dataset的总样本数为17,你的batch_size为8,就会报这样的错误
Expected scalar type but
RuntimeError: Expected object of scalar type Byte but got scalar type Float for argument #2 'mat2'
多半是forward中输入类型错误,把forward输入转换类型为dtype = torch.uint8
如果是long, 就转换为 torch.int64
如果是 X, 就转换为torch.x
转换的几种方式:
tensor1.type_as(tensor2)
torch.Tensor(tensor1,dtype=uint8)