import torch


def polar2cart(r, theta):
    """
    Transform polar coordinates to Cartesian.
    Parameters
    ----------
    r, theta : floats or arrays
        Polar coordinates
    Returns
    -------
    [x, y] : floats or arrays
        Cartesian coordinates    
    """
    return torch.stack((r * theta.cos(), r * theta.sin()), dim=-1).squeeze()