xcs = F.cosine_similarity(x[None,:,:], x[:,None,:], dim=-1)