mindsponge.common.quaternion_to_tensor

mindsponge.common.quaternion_to_tensor(quaternion, translation)[source]

Change quaternion to tensor.

\[\begin{split}\begin{split} &quaternion = [(x_1, y_1, z_1, m_1)] \\ &translation = [(x_2, y_2, z_2)] \\ &result = [(x_1, y_1, z_1, m_1, x_2, y_2, z_2)] \\ \end{split}\end{split}\]
Parameters
  • quaternion (Tensor) – Inputs quaternion. Tensor of shape \((..., 4)\).

  • translation (Tensor) – Inputs translation. Tensor of shape \((..., 3)\)

Returns

Tensor, The result of the concatenation between translation and translation. Tensor of shape \((..., 7)\).

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> from mindsponge.common.geometry import quaternion_to_tensor
>>> from mindspore.common import Tensor
>>> from mindspore import dtype as mstype
>>> np.random.seed(1)
>>> quaternion = Tensor(np.random.rand(4),dtype=mstype.float32)
>>> translation = Tensor(np.random.rand(3),dtype=mstype.float32)
>>> out = quaternion_to_tensor(quaternion, translation)
>>> print(out)
[0.6631489  0.44137922 0.97213906 0.7425225  0.3549025  0.6535310.5426164 ]