{"action":"created","comment":{"url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/comments/190923572","pull_request_review_id":123405463,"id":190923572,"diff_hunk":"@@ -695,6 +695,42 @@ void Emitter::CreateBinaryOps() {\n     return cast_result(CreateAutoBroadcast<ngraph::op::LessEq>(node),\n                        getType(node->dtype_));\n   };\n+  ngraph_op_funcs_[\"smooth_l1\"] = [this](const NodePtr& node) {\n+    /* Smooth L1 Loss is a loss specific for R-CNN franchise training\n+     * Smooth L1 Loss function:\n+     * f(x) = 0.5 * (sigma * x) ^ 2,     |x| < 1 / sigma^2\n+     *      = |x| - 0.5 / sigma / sigma, otherwise\n+     * When sigma = 1, it is equivalent to the Huber loss, evaluated at\n+     * delta = 1.\n+     * smooth_l1_loss = w_out * f(w_in * x)\n+     * with w_in, w_out provided by input_data.\n+     */\n+    auto input = op_map_[node->inputs_[0]];\n+    auto sigma =\n+        makeConstant(node, get_default(node, \"scalar\", std::string(\"0\")));\n+    auto sigma_sq = sigma * sigma;\n+    auto inv_sigma_sq = std::make_shared<ngraph::op::Divide>(\n+        makeConstant(node, \"1.0\"), sigma_sq);\n+\n+    // check if input is greater than inv_sigma_sq\n+    auto is_input_gt_sigma =\n+        std::make_shared<ngraph::op::Greater>(input, inv_sigma_sq);\n+\n+    // f(x) = 0.5 * (sigma * x) ^ 2","path":"src/ngraph/ngraph_emitter.cc","position":25,"original_position":25,"commit_id":"339348d57b8fd0e1a594dc8ad7db50061b987cfe","original_commit_id":"339348d57b8fd0e1a594dc8ad7db50061b987cfe","user":{"login":"cconvey","id":6146269,"avatar_url":"https://avatars0.githubusercontent.com/u/6146269?v=4","gravatar_id":"","url":"https://api.github.com/users/cconvey","html_url":"https://github.com/cconvey","followers_url":"https://api.github.com/users/cconvey/followers","following_url":"https://api.github.com/users/cconvey/following{/other_user}","gists_url":"https://api.github.com/users/cconvey/gists{/gist_id}","starred_url":"https://api.github.com/users/cconvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cconvey/subscriptions","organizations_url":"https://api.github.com/users/cconvey/orgs","repos_url":"https://api.github.com/users/cconvey/repos","events_url":"https://api.github.com/users/cconvey/events{/privacy}","received_events_url":"https://api.github.com/users/cconvey/received_events","type":"User","site_admin":false},"body":"💯 👍 🥇 for using comments to clarify what you intend to be computed by the nodes you're creating!\r\n\r\nIMO it would be helpful for you to _not_ use the function name `f(x)` in this line and below, unless you're defining a function that specifically matches one of the two versions of `f(x)` that you describe in the block-comment at the top of this commit.\r\n\r\nBy using the same name `f(x)` in all of those places, it's unclear regarding which computations here and below are meant to exactly correspond fo the two definitions of `f(x)` you use in the block-comment above.","created_at":"2018-05-25T15:06:50Z","updated_at":"2018-05-25T15:20:06Z","html_url":"https://github.com/NervanaSystems/ngraph-mxnet/pull/251#discussion_r190923572","pull_request_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/251","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/comments/190923572"},"html":{"href":"https://github.com/NervanaSystems/ngraph-mxnet/pull/251#discussion_r190923572"},"pull_request":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/251"}}},"pull_request":{"url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/251","id":190397923,"html_url":"https://github.com/NervanaSystems/ngraph-mxnet/pull/251","diff_url":"https://github.com/NervanaSystems/ngraph-mxnet/pull/251.diff","patch_url":"https://github.com/NervanaSystems/ngraph-mxnet/pull/251.patch","issue_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/issues/251","number":251,"state":"open","locked":false,"title":"add smooth_l1 op to ngraph emitter","user":{"login":"ashokei","id":29638935,"avatar_url":"https://avatars0.githubusercontent.com/u/29638935?v=4","gravatar_id":"","url":"https://api.github.com/users/ashokei","html_url":"https://github.com/ashokei","followers_url":"https://api.github.com/users/ashokei/followers","following_url":"https://api.github.com/users/ashokei/following{/other_user}","gists_url":"https://api.github.com/users/ashokei/gists{/gist_id}","starred_url":"https://api.github.com/users/ashokei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashokei/subscriptions","organizations_url":"https://api.github.com/users/ashokei/orgs","repos_url":"https://api.github.com/users/ashokei/repos","events_url":"https://api.github.com/users/ashokei/events{/privacy}","received_events_url":"https://api.github.com/users/ashokei/received_events","type":"User","site_admin":false},"body":"## Description ##\r\nadd smooth_l1 op to ngraph emitter\r\n\r\n## Checklist ##\r\n### Essentials ###\r\nPlease feel free to remove inapplicable items for your PR.\r\n- [ ] 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- [ ] Changes are complete (i.e. I finished coding on this PR)\r\n- [ ] 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- Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)\r\n- Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)\r\n- [ ] Code is well-documented: \r\n- For user-facing API changes, API doc string has been updated. \r\n- For new C++ functions in header files, their functionalities and arguments are documented. \r\n- For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable\r\n- Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html\r\n- [ ] 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- [ ] Feature1, tests, (and when applicable, API doc)\r\n- [ ] Feature2, tests, (and when applicable, API doc)\r\n\r\n## Comments ##\r\n- If this change is a backward incompatible change, why must this change be made.\r\n- Interesting edge cases to note here\r\n","created_at":"2018-05-24T19:37:45Z","updated_at":"2018-05-25T15:20:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82254988c9fdcc7fd984f2f22fdf33d0fabc8f2f","assignee":null,"assignees":[],"requested_reviewers":[{"login":"louisfeng","id":580346,"avatar_url":"https://avatars0.githubusercontent.com/u/580346?v=4","gravatar_id":"","url":"https://api.github.com/users/louisfeng","html_url":"https://github.com/louisfeng","followers_url":"https://api.github.com/users/louisfeng/followers","following_url":"https://api.github.com/users/louisfeng/following{/other_user}","gists_url":"https://api.github.com/users/louisfeng/gists{/gist_id}","starred_url":"https://api.github.com/users/louisfeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louisfeng/subscriptions","organizations_url":"https://api.github.com/users/louisfeng/orgs","repos_url":"https://api.github.com/users/louisfeng/repos","events_url":"https://api.github.com/users/louisfeng/events{/privacy}","received_events_url":"https://api.github.com/users/louisfeng/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/251/commits","review_comments_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/251/comments","review_comment_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/issues/251/comments","statuses_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/statuses/339348d57b8fd0e1a594dc8ad7db50061b987cfe","head":{"label":"NervanaSystems:ashoke/op_smooth_l1","ref":"ashoke/op_smooth_l1","sha":"339348d57b8fd0e1a594dc8ad7db50061b987cfe","user":{"login":"NervanaSystems","id":9260121,"avatar_url":"https://avatars2.githubusercontent.com/u/9260121?v=4","gravatar_id":"","url":"https://api.github.com/users/NervanaSystems","html_url":"https://github.com/NervanaSystems","followers_url":"https://api.github.com/users/NervanaSystems/followers","following_url":"https://api.github.com/users/NervanaSystems/following{/other_user}","gists_url":"https://api.github.com/users/NervanaSystems/gists{/gist_id}","starred_url":"https://api.github.com/users/NervanaSystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NervanaSystems/subscriptions","organizations_url":"https://api.github.com/users/NervanaSystems/orgs","repos_url":"https://api.github.com/users/NervanaSystems/repos","events_url":"https://api.github.com/users/NervanaSystems/events{/privacy}","received_events_url":"https://api.github.com/users/NervanaSystems/received_events","type":"Organization","site_admin":false},"repo":{"id":83846540,"name":"ngraph-mxnet","full_name":"NervanaSystems/ngraph-mxnet","owner":{"login":"NervanaSystems","id":9260121,"avatar_url":"https://avatars2.githubusercontent.com/u/9260121?v=4","gravatar_id":"","url":"https://api.github.com/users/NervanaSystems","html_url":"https://github.com/NervanaSystems","followers_url":"https://api.github.com/users/NervanaSystems/followers","following_url":"https://api.github.com/users/NervanaSystems/following{/other_user}","gists_url":"https://api.github.com/users/NervanaSystems/gists{/gist_id}","starred_url":"https://api.github.com/users/NervanaSystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NervanaSystems/subscriptions","organizations_url":"https://api.github.com/users/NervanaSystems/orgs","repos_url":"https://api.github.com/users/NervanaSystems/repos","events_url":"https://api.github.com/users/NervanaSystems/events{/privacy}","received_events_url":"https://api.github.com/users/NervanaSystems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NervanaSystems/ngraph-mxnet","description":"MXNet - nGraph integration","fork":false,"url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet","forks_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/forks","keys_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/teams","hooks_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/hooks","issue_events_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/events","assignees_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/tags","blobs_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/languages","stargazers_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/stargazers","contributors_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/contributors","subscribers_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/subscribers","subscription_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/subscription","commits_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/merges","archive_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/downloads","issues_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/deployments","created_at":"2017-03-03T22:18:43Z","updated_at":"2018-05-23T21:40:29Z","pushed_at":"2018-05-25T00:03:01Z","git_url":"git://github.com/NervanaSystems/ngraph-mxnet.git","ssh_url":"git@github.com:NervanaSystems/ngraph-mxnet.git","clone_url":"https://github.com/NervanaSystems/ngraph-mxnet.git","svn_url":"https://github.com/NervanaSystems/ngraph-mxnet","homepage":"","size":30658,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":6,"watchers":14,"default_branch":"master"}},"base":{"label":"NervanaSystems:master","ref":"master","sha":"4cdd490ae371d26d0abcb5f90c09d6a91fec39f3","user":{"login":"NervanaSystems","id":9260121,"avatar_url":"https://avatars2.githubusercontent.com/u/9260121?v=4","gravatar_id":"","url":"https://api.github.com/users/NervanaSystems","html_url":"https://github.com/NervanaSystems","followers_url":"https://api.github.com/users/NervanaSystems/followers","following_url":"https://api.github.com/users/NervanaSystems/following{/other_user}","gists_url":"https://api.github.com/users/NervanaSystems/gists{/gist_id}","starred_url":"https://api.github.com/users/NervanaSystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NervanaSystems/subscriptions","organizations_url":"https://api.github.com/users/NervanaSystems/orgs","repos_url":"https://api.github.com/users/NervanaSystems/repos","events_url":"https://api.github.com/users/NervanaSystems/events{/privacy}","received_events_url":"https://api.github.com/users/NervanaSystems/received_events","type":"Organization","site_admin":false},"repo":{"id":83846540,"name":"ngraph-mxnet","full_name":"NervanaSystems/ngraph-mxnet","owner":{"login":"NervanaSystems","id":9260121,"avatar_url":"https://avatars2.githubusercontent.com/u/9260121?v=4","gravatar_id":"","url":"https://api.github.com/users/NervanaSystems","html_url":"https://github.com/NervanaSystems","followers_url":"https://api.github.com/users/NervanaSystems/followers","following_url":"https://api.github.com/users/NervanaSystems/following{/other_user}","gists_url":"https://api.github.com/users/NervanaSystems/gists{/gist_id}","starred_url":"https://api.github.com/users/NervanaSystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NervanaSystems/subscriptions","organizations_url":"https://api.github.com/users/NervanaSystems/orgs","repos_url":"https://api.github.com/users/NervanaSystems/repos","events_url":"https://api.github.com/users/NervanaSystems/events{/privacy}","received_events_url":"https://api.github.com/users/NervanaSystems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NervanaSystems/ngraph-mxnet","description":"MXNet - nGraph integration","fork":false,"url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet","forks_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/forks","keys_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/teams","hooks_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/hooks","issue_events_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/events","assignees_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/tags","blobs_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/languages","stargazers_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/stargazers","contributors_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/contributors","subscribers_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/subscribers","subscription_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/subscription","commits_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/merges","archive_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/downloads","issues_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/deployments","created_at":"2017-03-03T22:18:43Z","updated_at":"2018-05-23T21:40:29Z","pushed_at":"2018-05-25T00:03:01Z","git_url":"git://github.com/NervanaSystems/ngraph-mxnet.git","ssh_url":"git@github.com:NervanaSystems/ngraph-mxnet.git","clone_url":"https://github.com/NervanaSystems/ngraph-mxnet.git","svn_url":"https://github.com/NervanaSystems/ngraph-mxnet","homepage":"","size":30658,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":6,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/251"},"html":{"href":"https://github.com/NervanaSystems/ngraph-mxnet/pull/251"},"issue":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/issues/251"},"comments":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/issues/251/comments"},"review_comments":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/251/comments"},"review_comment":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/pulls/251/commits"},"statuses":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-mxnet/statuses/339348d57b8fd0e1a594dc8ad7db50061b987cfe"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cconvey"}}