{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments/223785717","pull_request_review_id":162998021,"id":223785717,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzc4NTcxNw==","diff_hunk":"@@ -706,3 +706,53 @@ def hybrid_forward(self, F, pred, positive, negative):\n                      axis=self._batch_axis, exclude=True)\n         loss = F.relu(loss + self._margin)\n         return _apply_weighting(F, loss, self._weight, None)\n+\n+class CosineEmbeddingLoss(Loss):\n+    r\"\"\"For a target label 1 or -1, vectors target and pred, the function computes the cosine distance\n+    between the vectors. This can be interpretted as how similar/dissimilar two input vectors are.\n+\n+\n+    `pred`, `target` can have arbitrary shape as long as they have the same number of elements.","path":"python/mxnet/gluon/loss.py","position":26,"original_position":19,"commit_id":"c10f1efb8f299471be64ce82c21fa361f31f479e","original_commit_id":"eb9b9b48b73d373ab4c96a114f75a88bdcfa6d2a","user":{"login":"roywei","id":8022184,"node_id":"MDQ6VXNlcjgwMjIxODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8022184?v=4","gravatar_id":"","url":"https://api.github.com/users/roywei","html_url":"https://github.com/roywei","followers_url":"https://api.github.com/users/roywei/followers","following_url":"https://api.github.com/users/roywei/following{/other_user}","gists_url":"https://api.github.com/users/roywei/gists{/gist_id}","starred_url":"https://api.github.com/users/roywei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roywei/subscriptions","organizations_url":"https://api.github.com/users/roywei/orgs","repos_url":"https://api.github.com/users/roywei/repos","events_url":"https://api.github.com/users/roywei/events{/privacy}","received_events_url":"https://api.github.com/users/roywei/received_events","type":"User","site_admin":false},"body":"Please refer to[ huber loss ](https://github.com/gaurav-gireesh/incubator-mxnet/blob/cosineloss/python/mxnet/gluon/loss.py#L478)and use only `{case}`, remove `{gather}`. maybe your mathjax version and what we used in the website is different, so some formula is not recognized. A safe way is to use only what have been correctly rendered, those should be more than enough","created_at":"2018-10-09T17:05:02Z","updated_at":"2018-10-09T17:05:02Z","html_url":"https://github.com/apache/incubator-mxnet/pull/12750#discussion_r223785717","pull_request_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12750","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments/223785717"},"html":{"href":"https://github.com/apache/incubator-mxnet/pull/12750#discussion_r223785717"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12750"}},"in_reply_to_id":223225854},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12750","id":220854836,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwODU0ODM2","html_url":"https://github.com/apache/incubator-mxnet/pull/12750","diff_url":"https://github.com/apache/incubator-mxnet/pull/12750.diff","patch_url":"https://github.com/apache/incubator-mxnet/pull/12750.patch","issue_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/12750","number":12750,"state":"open","locked":false,"title":"[MXNET -1030] Cosine Embedding Loss","user":{"login":"gaurav-gireesh","id":28286834,"node_id":"MDQ6VXNlcjI4Mjg2ODM0","avatar_url":"https://avatars1.githubusercontent.com/u/28286834?v=4","gravatar_id":"","url":"https://api.github.com/users/gaurav-gireesh","html_url":"https://github.com/gaurav-gireesh","followers_url":"https://api.github.com/users/gaurav-gireesh/followers","following_url":"https://api.github.com/users/gaurav-gireesh/following{/other_user}","gists_url":"https://api.github.com/users/gaurav-gireesh/gists{/gist_id}","starred_url":"https://api.github.com/users/gaurav-gireesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaurav-gireesh/subscriptions","organizations_url":"https://api.github.com/users/gaurav-gireesh/orgs","repos_url":"https://api.github.com/users/gaurav-gireesh/repos","events_url":"https://api.github.com/users/gaurav-gireesh/events{/privacy}","received_events_url":"https://api.github.com/users/gaurav-gireesh/received_events","type":"User","site_admin":false},"body":"## Description ##\r\nFor a target label 1 or -1, vectors target and prediction, the function computes the cosine distance between the vectors. This can be interpreted as how similar/dissimilar two input vectors are.\r\nCan be used as a loss function while training models.\r\n\r\n\r\n## Checklist ##\r\n### Essentials ###\r\nPlease feel free to remove inapplicable items for your PR.\r\n- [x] The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant [JIRA issue](https://issues.apache.org/jira/projects/MXNET/issues) created (except PRs with tiny changes)\r\n- [x] Changes are complete (i.e. I finished coding on this PR)\r\n- [x] All changes have test coverage:\r\n- Unit tests are added for small changes to verify correctness (e.g. adding a new operator)\r\n\r\n- [x] Code is well-documented: \r\n\r\n- [x] To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change\r\n\r\n### Changes ###\r\n- [x] Cosine Embedding Loss computation function tests, (and when applicable, API doc)\r\n\r\n\r\n## Comments ##\r\n- If this change is a backward incompatible change, why must this change be made.\r\n","created_at":"2018-10-06T00:48:28Z","updated_at":"2018-10-09T17:05:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc682a66365bb933bb977f19a76cc5d8aa9d0fd1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1018798522,"node_id":"MDU6TGFiZWwxMDE4Nzk4NTIy","url":"https://api.github.com/repos/apache/incubator-mxnet/labels/pr-awaiting-review","name":"pr-awaiting-review","color":"d93f0b","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12750/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12750/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/12750/comments","statuses_url":"https://api.github.com/repos/apache/incubator-mxnet/statuses/c10f1efb8f299471be64ce82c21fa361f31f479e","head":{"label":"gaurav-gireesh:cosineloss","ref":"cosineloss","sha":"c10f1efb8f299471be64ce82c21fa361f31f479e","user":{"login":"gaurav-gireesh","id":28286834,"node_id":"MDQ6VXNlcjI4Mjg2ODM0","avatar_url":"https://avatars1.githubusercontent.com/u/28286834?v=4","gravatar_id":"","url":"https://api.github.com/users/gaurav-gireesh","html_url":"https://github.com/gaurav-gireesh","followers_url":"https://api.github.com/users/gaurav-gireesh/followers","following_url":"https://api.github.com/users/gaurav-gireesh/following{/other_user}","gists_url":"https://api.github.com/users/gaurav-gireesh/gists{/gist_id}","starred_url":"https://api.github.com/users/gaurav-gireesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaurav-gireesh/subscriptions","organizations_url":"https://api.github.com/users/gaurav-gireesh/orgs","repos_url":"https://api.github.com/users/gaurav-gireesh/repos","events_url":"https://api.github.com/users/gaurav-gireesh/events{/privacy}","received_events_url":"https://api.github.com/users/gaurav-gireesh/received_events","type":"User","site_admin":false},"repo":{"id":148394563,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgzOTQ1NjM=","name":"incubator-mxnet","full_name":"gaurav-gireesh/incubator-mxnet","private":false,"owner":{"login":"gaurav-gireesh","id":28286834,"node_id":"MDQ6VXNlcjI4Mjg2ODM0","avatar_url":"https://avatars1.githubusercontent.com/u/28286834?v=4","gravatar_id":"","url":"https://api.github.com/users/gaurav-gireesh","html_url":"https://github.com/gaurav-gireesh","followers_url":"https://api.github.com/users/gaurav-gireesh/followers","following_url":"https://api.github.com/users/gaurav-gireesh/following{/other_user}","gists_url":"https://api.github.com/users/gaurav-gireesh/gists{/gist_id}","starred_url":"https://api.github.com/users/gaurav-gireesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaurav-gireesh/subscriptions","organizations_url":"https://api.github.com/users/gaurav-gireesh/orgs","repos_url":"https://api.github.com/users/gaurav-gireesh/repos","events_url":"https://api.github.com/users/gaurav-gireesh/events{/privacy}","received_events_url":"https://api.github.com/users/gaurav-gireesh/received_events","type":"User","site_admin":false},"html_url":"https://github.com/gaurav-gireesh/incubator-mxnet","description":"Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more","fork":true,"url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet","forks_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/forks","keys_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/teams","hooks_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/hooks","issue_events_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/events","assignees_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/tags","blobs_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/languages","stargazers_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/stargazers","contributors_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/contributors","subscribers_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/subscribers","subscription_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/subscription","commits_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/merges","archive_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/downloads","issues_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/gaurav-gireesh/incubator-mxnet/deployments","created_at":"2018-09-11T23:52:19Z","updated_at":"2018-09-28T18:03:36Z","pushed_at":"2018-10-09T14:43:10Z","git_url":"git://github.com/gaurav-gireesh/incubator-mxnet.git","ssh_url":"git@github.com:gaurav-gireesh/incubator-mxnet.git","clone_url":"https://github.com/gaurav-gireesh/incubator-mxnet.git","svn_url":"https://github.com/gaurav-gireesh/incubator-mxnet","homepage":"https://mxnet.apache.org","size":44148,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"c2bb01222e2105a306456c05b92c637b9db4505d","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":34864402,"node_id":"MDEwOlJlcG9zaXRvcnkzNDg2NDQwMg==","name":"incubator-mxnet","full_name":"apache/incubator-mxnet","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apache/incubator-mxnet","description":"Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more","fork":false,"url":"https://api.github.com/repos/apache/incubator-mxnet","forks_url":"https://api.github.com/repos/apache/incubator-mxnet/forks","keys_url":"https://api.github.com/repos/apache/incubator-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-mxnet/teams","hooks_url":"https://api.github.com/repos/apache/incubator-mxnet/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-mxnet/events","assignees_url":"https://api.github.com/repos/apache/incubator-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-mxnet/tags","blobs_url":"https://api.github.com/repos/apache/incubator-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-mxnet/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-mxnet/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-mxnet/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-mxnet/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-mxnet/subscription","commits_url":"https://api.github.com/repos/apache/incubator-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-mxnet/merges","archive_url":"https://api.github.com/repos/apache/incubator-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-mxnet/downloads","issues_url":"https://api.github.com/repos/apache/incubator-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-mxnet/deployments","created_at":"2015-04-30T16:21:15Z","updated_at":"2018-10-09T16:33:00Z","pushed_at":"2018-10-09T16:50:27Z","git_url":"git://github.com/apache/incubator-mxnet.git","ssh_url":"git@github.com:apache/incubator-mxnet.git","clone_url":"https://github.com/apache/incubator-mxnet.git","svn_url":"https://github.com/apache/incubator-mxnet","homepage":"https://mxnet.apache.org","size":46367,"stargazers_count":15352,"watchers_count":15352,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5550,"mirror_url":null,"archived":false,"open_issues_count":901,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":5550,"open_issues":901,"watchers":15352,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12750"},"html":{"href":"https://github.com/apache/incubator-mxnet/pull/12750"},"issue":{"href":"https://api.github.com/repos/apache/incubator-mxnet/issues/12750"},"comments":{"href":"https://api.github.com/repos/apache/incubator-mxnet/issues/12750/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12750/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12750/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-mxnet/statuses/c10f1efb8f299471be64ce82c21fa361f31f479e"}},"author_association":"NONE"}}
{"actor":{"display_login":"roywei"}}