import torch


def array_from_skew_matrix(x, device=torch.device("cpu"), dtype=torch.float32):
    """
Receives a skew matrix and returns its associated 3-element vector (array).

    :param x: Skew matrix (3x3)
    :return: Associated array (3-element).
    :param device: Device to allocate new tensors. Default: torch.device("cpu").
    :param dtype: Data type for new tensors. Default: torch.float32.
    """
    # We are only slicing the last index in order to keep last dimension.
    return torch.hstack((x[:, 2, 1:2], x[:, 0, 2:], x[:, 1, 0:1]))