@aswamy
``
in1 = input1.squeeze()
in2 = input2.squeeze()
in11 = F.normalize(in1, dim=1)
in22 = F.normalize(in2, dim=0)
torch.cdist(in11, in22, p=2)

The output shape would be `(3,10,128)` where the `(10, 128)` would be your 1280 cosine similarity values that you need. Unsqueeze appropriate dims to get the desired shape.

The logic behind this is that,

 `l2_distance(l2_normalized_vector_1, l2_normalized_vector_2) = k*CosineSimilarity(UnNormalized_vector_1, UnNormalized_vector_2)`

where `k` is a constant.

Refer [this](https://stats.stackexchange.com/questions/146221/is-cosine-similarity-identical-to-l2-normalized-euclidean-distance) for more on it.