def __init__(self, dim=1, attn='cosine'):
    super().__init__()
    self.softmax = nn.Softmax(dim=dim)
    if (attn == 'cosine'):
        self.cosine = nn.CosineSimilarity(dim=dim)
    self.attn = attn
    self.dim = dim
def __init__(self, dim=1, attn='cosine'):
    super().__init__()
    self.softmax = nn.Softmax(dim=dim)
    if (attn == 'cosine'):
        self.cosine = nn.CosineSimilarity(dim=dim)
    self.attn = attn
    self.dim = dim