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 --------- 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: