def quaternion_log_to_exp(quaternion: torch.Tensor, eps: float=1e-08) -> torch.Tensor:
    'Applies exponential map to log quaternion.\n    The quaternion should be in (x, y, z, w) format.\n\n    Args:\n        quaternion (torch.Tensor): a tensor containing a quaternion to be\n          converted. The tensor can be of shape :math:`(*, 3)`.\n\n    Return:\n        torch.Tensor: the quaternion exponential map of shape :math:`(*, 4)`.\n\n    Example:\n        >>> quaternion = torch.tensor([0., 0., 0.])\n        >>> quaternion_log_to_exp(quaternion)\n        tensor([0., 0., 0., 1.])\n    '
    if (not isinstance(quaternion, torch.Tensor)):
        raise TypeError('Input type is not a torch.Tensor. Got {}'.format(type(quaternion)))
    if (not (quaternion.shape[(- 1)] == 3)):
        raise ValueError('Input must be a tensor of shape (*, 3). Got {}'.format(quaternion.shape))
    norm_q: torch.Tensor = torch.norm(quaternion, p=2, dim=(- 1), keepdim=True).clamp(min=eps)
    quaternion_vector: torch.Tensor = ((quaternion * torch.sin(norm_q)) / norm_q)
    quaternion_scalar: torch.Tensor = torch.cos(norm_q)
    quaternion_exp: torch.Tensor = torch.cat([quaternion_vector, quaternion_scalar], dim=(- 1))
    return quaternion_exp
Applies exponential map to log quaternion.
The quaternion should be in (x, y, z, w) format.

Args:
    quaternion (torch.Tensor): a tensor containing a quaternion to be
      converted. The tensor can be of shape :math:`(*, 3)`.

Return:
    torch.Tensor: the quaternion exponential map of shape :math:`(*, 4)`.

Example:
    >>> quaternion = torch.tensor([0., 0., 0.])
    >>> quaternion_log_to_exp(quaternion)
    tensor([0., 0., 0., 1.])
def quaternion_log_to_exp(quaternion: torch.Tensor, eps: float=1e-08) -> torch.Tensor:
    'Applies exponential map to log quaternion.\n    The quaternion should be in (x, y, z, w) format.\n\n    Args:\n        quaternion (torch.Tensor): a tensor containing a quaternion to be\n          converted. The tensor can be of shape :math:`(*, 3)`.\n\n    Return:\n        torch.Tensor: the quaternion exponential map of shape :math:`(*, 4)`.\n\n    Example:\n        >>> quaternion = torch.tensor([0., 0., 0.])\n        >>> quaternion_log_to_exp(quaternion)\n        tensor([0., 0., 0., 1.])\n    '
    if (not isinstance(quaternion, torch.Tensor)):
        raise TypeError('Input type is not a torch.Tensor. Got {}'.format(type(quaternion)))
    if (not (quaternion.shape[(- 1)] == 3)):
        raise ValueError('Input must be a tensor of shape (*, 3). Got {}'.format(quaternion.shape))
    norm_q: torch.Tensor = torch.norm(quaternion, p=2, dim=(- 1), keepdim=True).clamp(min=eps)
    quaternion_vector: torch.Tensor = ((quaternion * torch.sin(norm_q)) / norm_q)
    quaternion_scalar: torch.Tensor = torch.cos(norm_q)
    quaternion_exp: torch.Tensor = torch.cat([quaternion_vector, quaternion_scalar], dim=(- 1))
    return quaternion_exp