import torch


def gram(m: torch.Tensor) -> torch.Tensor:
    """
    Return the Gram matrix of `m`

    Args:
        m (tensor): a matrix of dim 2

    Returns:
        The Gram matrix
    """
    g = torch.einsum('ik,jk->ij', m, m) / m.shape[1]
    return g