import torch


def points_to_cartesian(batch: torch.Tensor) -> torch.Tensor:
    """
    Transforms a batch of points in homogeneous coordinates back to cartesian
    coordinates.

    Args:
        batch: batch of points in homogeneous coordinates. Should be of shape
            BATCHSIZE x NUMPOINTS x NDIM+1

    Returns:
        torch.Tensor: the batch of points in cartesian coordinates

    """

    return batch[..., :-1] / batch[..., -1, None]