You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/10/07 19:57:45 UTC

[GitHub] szha commented on a change in pull request #12750: [MXNET -1030] Cosine Embedding Loss

szha commented on a change in pull request #12750: [MXNET -1030] Cosine Embedding Loss
URL: https://github.com/apache/incubator-mxnet/pull/12750#discussion_r223225854
 
 

 ##########
 File path: python/mxnet/gluon/loss.py
 ##########
 @@ -706,3 +706,53 @@ def hybrid_forward(self, F, pred, positive, negative):
                      axis=self._batch_axis, exclude=True)
         loss = F.relu(loss + self._margin)
         return _apply_weighting(F, loss, self._weight, None)
+
+class CosineEmbeddingLoss(Loss):
+    r"""For a target label 1 or -1, vectors target and pred, the function computes the cosine distance
+    between the vectors. This can be interpretted as how similar/dissimilar two input vectors are.
+
+
+    `pred`, `target` can have arbitrary shape as long as they have the same number of elements.
 
 Review comment:
   could you document the formula here? our website supports mathjax so you can write latex for it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services