評價此頁

torch.unbind#

torch.unbind(input, dim=0) seq#

移除張量的某個維度。

沿給定維度返回所有切片組成的元組,該維度已移除。

引數
  • input (Tensor) – 要解綁的張量

  • dim (int) – 要移除的維度

示例

>>> torch.unbind(torch.tensor([[1, 2, 3],
>>>                            [4, 5, 6],
>>>                            [7, 8, 9]]))
(tensor([1, 2, 3]), tensor([4, 5, 6]), tensor([7, 8, 9]))