📜  torch.unsqueze - Python 代码示例

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

代码示例1
>>> x = torch.tensor([1, 2, 3, 4])
>>> torch.unsqueeze(x, 0)
tensor([[ 1,  2,  3,  4]])
>>> torch.unsqueeze(x, 1)
tensor([[ 1],
        [ 2],
        [ 3],
        [ 4]])