Calculation of cosine similarity is giving error

Hi @amolpol98,

Shapes of demon and dt are different when you attempt the elemwise_div. You can either keep 2 dimensions when applying norm with norm(result1, keepdims=True) or add an axis to demon with .expand_dims(0). Are you performing this on batched data? If so, you’ll want to reformulate your cosine similarity. Check out this example.