import torch


def affine_make_rect(affine):
    """Transform a square affine into a rectangular affine.

    Parameters
    ----------
    affine : (..., ndim[+1], ndim+1) tensor

    Returns
    -------
    affine : (..., ndim, ndim+1) tensor

    """
    affine = torch.as_tensor(affine)
    ndims = affine.shape[-1]-1
    return affine[..., :ndims, :]