import torch


def remove_first_sv(emb, first_sv):
    """
    Projects out the first singular value (first_sv) from the embedding (emb).

    Inputs:
      emb: torch Tensor shape (glove_dim)
      first_sv: torch Tensor shape (glove_dim)

    Returns:
      new emb: torch Tensor shape (glove_dim)
    """
    # Calculate dot prod of emb and first_sv using torch.mm:
    # (1, glove_dim) x (glove_dim, 1) -> (1,1) -> float
    dot_prod = torch.mm(torch.unsqueeze(emb, 0), torch.unsqueeze(first_sv, 1)).item()
    return emb - first_sv * dot_prod