i have following target embeddings vector u shape of (768,) and target embeddings matrix v shape of (23, 768). I need to calculate cosine similarity between target vector and matrix. I know how to do it in cycle:
from sklearn.metrics.pairwise import cosine_similarity
for i in v:
cosine_similarity(u.reshape(-1, 1), i.reshape(-1,1))[0][0]
But how to do it like numpy way ? My target is to have array of cosine similarities like
array[0.4, 0.5, 0.6, ... n]