【Pytorch】torch.squeeze和torch.unsqueeze
torch.squeeze(input, int)
返回一个张量,其可以在原来的input的shape基础之上,压缩维度,比如输入的input的shape为torch.Size([31, 1, 8]),调用torch.squeeze(input, 1),意思就是将原来的input的第二列**(0,1,2三列)**“删除”,返回的tensor的shape为 torch.Size([31, 8])
注意点 int的范围:假设原来shape有 x 列,则int可以取 [-x, x-1]
>>> a = torch.rand([32, 1<