mindsponge.common.vecs_expand_dims

mindsponge.common.vecs_expand_dims(v, axis)[源代码]

将输入的v在指定的轴添加额外维度。

参数:
  • v (Tuple) - 输入的初始向量,长度为3,\((xx, xy, xz)\)

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

返回:

tuple,如果 axis 的值为0,且 \(xx\) 的shape为 \((... , X_R)\) ,拓展后的shape为 \((1, ..., X_R)\) 。若 axis为其它值,则在其它方向拓展,返回拓展后的 \((xx, xy, xz, yx, yy, yz, zx, zy, zz)\)

支持平台:

Ascend GPU

样例:

>>> from mindsponge.common.geometry import vecs_expand_dims
>>> from mindspore.common import Tensor
>>> from mindspore import dtype as mstype
>>> v = (1, 2, 3)
>>> axis = 0
>>> output= vecs_expand_dims(v, axis)
>>> print(output)
(Tensor(shape=[1], dtype=Int64, value=[1]),Tensor(shape=[1], dtype=Int64, value=[2]),
Tensor(shape=[1], dtype=Int64, value=[3]))