import torch


def append_homog(tensor: torch.Tensor, homog_value: float = 1.) -> torch.Tensor:
    """Appends a homogeneous coordinate to the last dimension of a Tensor.

    Args:
    tensor: A Tensor.
    homog_value: Value to append as homogeneous coordinate to the last dimension
        of `tensor`.  (Default: 1.0)

    Returns:
    A Tensor identical to the input but one larger in the last dimension.  The
    new entries are filled with ones.
    """
    shape = list(tensor.shape)
    shape[-1] = 1
    appendage = torch.ones(shape, dtype=tensor.dtype, device=tensor.device) * homog_value
    return torch.cat([tensor, appendage], -1)