import torch


def se2_element(G):
    """
    Returns three new tensors corresponding to x, y and theta attributes of the group elements specified by the
    se2 group elements in matrix formulation.

    Args:
        G (`torch.FloatTensor`): matrix formulation of the group elements.

    Returns:
        (`torch.FloatTensor`): x attributes of the group elements.
        (`torch.FloatTensor`): y attributes of the group elements.
        (`torch.FloatTensor`): theta attributes of the group elements.
    """
    return G[..., 0, 2], G[..., 1, 2], torch.atan2(G[..., 1, 0], G[..., 0, 0])