Shortcuts

torch.Tensor.dim_order

Tensor.dim_order() tuple[源代码]

返回一个整数元组,描述self的维度顺序或物理布局。

Parameters

Dim order 表示维度在内存中的布局方式,从最外层到最内层维度。

Example::
>>> torch.empty((2, 3, 5, 7)).dim_order()
(0, 1, 2, 3)
>>> torch.empty((2, 3, 5, 7), memory_format=torch.channels_last).dim_order()
(0, 2, 3, 1)

警告

dim_order 张量 API 是实验性的,可能会发生变化。

优云智算