• 文档 >
  • torch >
  • torch.msort
快捷键

torch.msort

torch.msort(input: Tensor, *, out: Optional[Tensor]) Tensor

按值升序对 input 张量的第一个维度上的元素进行排序。

注意

torch.msort(t) 等价于 torch.sort(t, dim=0)[0]。参见 torch.sort()

参数:

input (Tensor) – 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> t = torch.randn(3, 4)
>>> t
tensor([[-0.1321,  0.4370, -1.2631, -1.1289],
        [-2.0527, -1.1250,  0.2275,  0.3077],
        [-0.0881, -0.1259, -0.5495,  1.0284]])
>>> torch.msort(t)
tensor([[-2.0527, -1.1250, -1.2631, -1.1289],
        [-0.1321, -0.1259, -0.5495,  0.3077],
        [-0.0881,  0.4370,  0.2275,  1.0284]])

© 版权所有 PyTorch 贡献者。

使用 Sphinx 构建,并使用 Read the Docs 提供的主题。

文档

PyTorch 的全面开发者文档

查看文档

教程

深入了解初学者和高级开发者的教程

查看教程

资源

查找开发资源并获得您的疑问解答

查看资源