import torch


def generate_vectors(num_vectors, dims):
    """
    Generate n vectors of size dims that are orthogonal to each other.
    """
    if num_vectors > dims:
        raise ValueError("num_vectors cannot be greater than dims!")

    # Intializing class vectors.
    vecs = torch.randn(dims, num_vectors, dtype=torch.float)

    # Using QR decomposition to get orthogonal vectors.
    vecs, _ = torch.qr(vecs)
    vecs = vecs.t()
    vecs = vecs / torch.norm(vecs, dim=-1, keepdim=True)
    return vecs