From 8502f79b0ba7f30a72e6728d967d33f135da0398 Mon Sep 17 00:00:00 2001 From: dithyrambe Date: Tue, 14 Jan 2020 21:14:36 +0100 Subject: [PATCH 1/2] Fix CosineEmbeddingLoss in when symbol API is used Fixes #17275 --- python/mxnet/gluon/loss.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/mxnet/gluon/loss.py b/python/mxnet/gluon/loss.py index 40fdaa51573e..dac9a3215aa7 100644 --- a/python/mxnet/gluon/loss.py +++ b/python/mxnet/gluon/loss.py @@ -922,9 +922,9 @@ def hybrid_forward(self, F, input1, input2, label, sample_weight=None): def _cosine_similarity(self, F, x, y, axis=-1): # Calculates the cosine similarity between 2 vectors - x_norm = F.norm(x, axis=axis).reshape(-1, 1) - y_norm = F.norm(y, axis=axis).reshape(-1, 1) - x_dot_y = F.sum(x * y, axis=axis).reshape(-1, 1) + x_norm = F.norm(x, axis=axis).reshape((-1, 1)) + y_norm = F.norm(y, axis=axis).reshape((-1, 1)) + x_dot_y = F.sum(x * y, axis=axis).reshape((-1, 1)) if F is ndarray: eps_arr = F.array([1e-12]) else: From ef3091c82dfd428c3c9e358d9a1d5cf5512c5a9c Mon Sep 17 00:00:00 2001 From: dithyrambe Date: Tue, 14 Jan 2020 21:38:55 +0100 Subject: [PATCH 2/2] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 31019e6355ab..31400aed651c 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -247,6 +247,7 @@ List of Contributors * [Disi A](https://github.com/adis300) * [Vandana Kannan](https://github.com/vandanavk) * [Guanxin Qiao](https://github.com/guanxinq) +* [dithyrambe](https://github.com/dithyrambe) Label Bot ---------