import torch.nn.functional as F
import torch


def similarity(x, y):
    """
    calculate similarity between x and y

    Args:
        x: feature vector, shape 1xF
        y: feature vector, shape 1xF
        
    Returns:
        reel number indicating similarity
    """
    return F.cosine_similarity(torch.Tensor(x.reshape(1, -1)), 
                               torch.Tensor(y.reshape(1, -1)))