Error1:
mean = torch.cat([mean, y], 1)
RuntimeError: invalid argument 0: Tensors must have same number of dimensions: got 2 and 4 at /pytorch/aten/src/TH/generic/THTensor.cpp:603
查看相关tensor shape:
mean_shape: (1, 2)
y_shape: (1, 32, 13, 10)
解决办法:
y = y.view(-1, 321310)
mean = torch.cat([mean, y], 1)
view用法
cat用法
Error2:
RuntimeError: size mismatch, m1: [1 x 4175], m2: [15 x 256] at /pytorch/aten/src/TH/generic/THTensorMath.cpp:136
原因:
做矩阵乘法,m1的4175需要m2的行即15相等.