查看tensor维度

        for b in range(imgs.size()[1]):  
            print(imgs.shape)  # torch.Size([3, 64, 120, 120])
            print(imgs.shape[0])
            print(imgs.shape[1])
            print(imgs.shape[2])
            print(imgs.size())  # torch.Size([3, 64, 120, 120])
            print(imgs.size()[0])
            print(imgs.size()[1])
            print(imgs.size()[2])
torch.Size([3, 64, 120, 120])
3
64
120
torch.Size([3, 64, 120, 120])
3
64
120

你可能感兴趣的:(pytorch)