mindsponge.common.quat_affine

mindsponge.common.quat_affine(quaternion, translation, rotation=None, normalize=True, unstack_inputs=False, use_numpy=False)[source]

Create quat affine representations based on rots and trans.

Parameters
  • quaternion (tensor) – Shape is \((N_{res}, 4)\).

  • translation (tensor) – Shape is \((N_{res}, 3)\).

  • rotation (tensor) – Rots, shape is \((N_{res}, 9)\). Default: None.

  • normalize (bool) – Whether to use normalization. Default: True.

  • unstack_inputs (bool) – Whether input is vector(True) of Tensor(False). Default: False.

  • use_numpy (bool) – Whether to use numpy. Default: False.

Returns

result after quat affine.

  • quaternion, tensor, shape is \((N_{res}, 4)\) .

  • rotation, tuple, \((xx, xy, xz, yx, yy, yz, zx, zy, zz)\), shape of every element is \((N_{res},)\) .

  • translation, tensor, shape is \((N_{res}, 3)\) .

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> import mindspore as ms
>>> from mindspore import Tensor
>>> from mindsponge.common.geometry import quat_affine
>>> input_0 = Tensor(np.ones((256, 4)), ms.float32)
>>> input_1 = Tensor(np.ones((256, 3)), ms.float32)
>>> qua, rot, trans = quat_affine(input_0, input_1)
>>> print(qua.shape, len(rot), rot[0].shape, trans.shape)
(256, 4), 9, (256,), (256, 3)