MuggleWang / CosFace_pytorch

Pytorch implementation of CosFace
MIT License
243 stars 52 forks source link

Question w.r.t cosine_sim #13

Closed LLYXC closed 5 years ago

LLYXC commented 5 years ago

Hi, thank you so much for sharing your code. I found torch.ger() is used to compute the cosine similarity between two vectors under the file 'layer.py'. However, this operation is used for obtaining the outer product. Should the inner product be used here?

ps. I closed an issue with the same question where I miss-typed your name. Sorry about that.

LLYXC commented 5 years ago

Oh, my bad. torch.ger() cannot be replaced with torch.dot() since the inner product is already there by torch.mm(x1,x2).