mindsponge.common.rots_expand_dims

mindsponge.common.rots_expand_dims(rots, axis)[源代码]

对旋转矩阵 rots 的各个部分在指定的轴上添加额外维度。

参数:
  • rots (Tuple) - 旋转矩阵 (xx,xy,xz,yx,yy,yz,zx,zy,zz) ,且xx, xy等均为Tensor且shape相同。

  • axis (Int) - 新插入的维度的位置,仅接受常量输入。

返回:

rots, Tuple。如果 axis 的值为0, xx 的 shape 为 (...,XR) ,其中 XR 为任意数,拓展后为 (1,...,XR) ,若axis不为0则在对应轴拓展,返回拓展后的 (xx,xy,xz,yx,yy,yz,zx,zy,zz) 矩阵。

支持平台:

Ascend GPU

样例:

>>> from mindsponge.common.geometry import rots_expand_dims
>>> from mindspore.common import Tensor
>>> from mindspore import dtype as mstype
>>> rots = (1, 2, 3, 4, 5, 6, 7, 8, 9)
>>> axis = 0
>>> rots_expand_dims(rots, axis)
>>> print(output)
(Tensor(shape=[1], dtype=Int64, value=[1]), Tensor(shape=[1], dtype=Int64, value=[2]),
Tensor(shape=[1], dtype=Int64, value=[3]), Tensor(shape=[1], dtype=Int64, value=[4]),
Tensor(shape=[1], dtype=Int64, value=[5]), Tensor(shape=[1], dtype=Int64, value=[6]),
Tensor(shape=[1], dtype=Int64, value=[7]), Tensor(shape=[1], dtype=Int64, value=[8]),
Tensor(shape=[1], dtype=Int64, value=[9]))