import torch


def get_plane(basis):
    """
    returns two vectors that define the span of a random plane
    that is in the span of the basis
    """
    n_basis = basis.size(-1)
    wghts = torch.randn(n_basis, 1).to(basis.device)
    dir1 = basis.matmul(wghts)

    wghts = torch.randn(n_basis, 1).to(basis.device)
    dir2 = basis.matmul(wghts)

    ## now gram schmidt these guys ##
    vu = dir2.squeeze().dot(dir1.squeeze())
    uu = dir1.squeeze().dot(dir1.squeeze())

    dir2 = dir2 - dir2.mul(vu).div(uu)

    ## normalize ##
    dir1 = dir1.div(dir1.norm())
    dir2 = dir2.div(dir2.norm())

    return dir1, dir2