📜  torch.unsqueeze - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:07.886000             🧑  作者: Mango

代码示例2
a = torch.randn(4, 4, 4)
>>> torch.unsqueeze(a, 0).size()
torch.Size([1, 4, 4, 4])

>>> torch.unsqueeze(a, 1).size()
torch.Size([4, 1, 4, 4])

>>> torch.unsqueeze(a, 2).size()
torch.Size([4, 4, 1, 4])

>>> torch.unsqueeze(a, 3).size()
torch.Size([4, 4, 4, 1])