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]))
本页目录