import torch


def cos(a, b):
    """
    Compute cosine similarity between two vectors.
    :param a: vec 1
    :param b: vec 2
    :return: cos(a,b)
    """
    return torch.dot(a, b) / (torch.norm(a) * torch.norm(b))