import torch


def get_cosinebased_yaw_pitch(input_: torch.Tensor) -> torch.Tensor:
    """
    Returns a tensor with two columns being yaw and pitch respectively. For yaw, it uses cos(yaw)'s value along with
    sin(yaw)'s sign.
    Args:
        input_: 1st column is sin(yaw), 2nd Column is cos(yaw), 3rd Column is sin(pitch)
    """

    yaw_pitch_cosine = torch.zeros((input_.shape[0], 2))
    yaw_pitch_cosine[:, 1] = torch.asin(input_[:, 2])

    yaw = torch.acos(input_[:, 1])
    right = (input_[:, 0] < 0.)
    yaw[right] = -1 * yaw[right]

    yaw_pitch_cosine[:, 0] = yaw
    return yaw_pitch_cosine