Pytorch 维度变换Pytorch 维度变换
Pytorch 维度变换view reshapeimport torcha = torch.rand(4, 1, 28, 28)print("a.shape:\t", a.shape)# prod(a.size) = prod(a'.size)b = a.view(4, 28*28)print("b:\t", b)c = a.view(4, 28*28).shapeprint("c:\t", c)d = a.view(4, 784)