(e)
return np.concatenate((w, xyz), axis=1).reshape(original_shape)
Convert axis-angle rotations (aka exponential maps) to quaternions.
    Stable formula from "Practical Parameterization of Rotations Using the Exponential Map".
    Expects a tensor of shape (*, 3), where * denotes any number of dimensions.
    Returns a tensor of shape (*, 4).
Convert axis-angle rotations (aka exponential maps) to quaternions.
    Stable formula from "Practical Parameterization of Rotations Using the Exponential Map".
    Expects a tensor of shape (*, 3), where * denotes any number of dimensions.
    Returns a tensor of shape (*, 4).
Convert axis - angle rotations ( aka exponential maps ) to quaternions . Stable formula from Practical Parameterization of Rotations Using the Exponential Map . Expects a tensor of shape ( * 3 ) where * denotes any number of dimensions . Returns a tensor of shape ( * 4 ) .
def expmap_to_quaternion(e):
    """
    Convert axis-angle rotations (aka exponential maps) to quaternions.
    Stable formula from "Practical Parameterization of Rotations Using the Exponential Map".
    Expects a tensor of shape (*, 3), where * denotes any number of dimensions.
    Returns a tensor of shape (*, 4).
    """
    assert e.shape[-1] == 3

    original_shape = list(e.shape)
    original_shape[-1] = 4
    e = e.reshape(-1, 3)

    theta = np.linalg.norm(e, axis=1).reshape(-1, 1)
    w = np.cos(0.5 * theta).reshape(-1, 1)
    xyz = 0.5 * np.sinc(0.5 * theta / np.pi) * e
    return np.concatenate((w, xyz), axis=1).reshape(original_shape)
def expmap_to_quaternion ( e ) : assert e . shape [ - 1 ] == 3 original_shape = list ( e . shape ) original_shape [ - 1 ] = 4 e = e . reshape ( - 1 , 3 ) theta = np . linalg . norm ( e , axis = 1 ) . reshape ( - 1 , 1 ) w = np . cos ( 0.5 * theta ) . reshape ( - 1 , 1 ) xyz = 0.5 * np . sinc ( 0.5 * theta / np . pi ) * e return np . concatenate ( ( w , xyz ) , axis = 1 ) . reshape ( original_shape )