{"action":"created","comment":{"url":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/comments/232824705","pull_request_review_id":174109297,"id":232824705,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjgyNDcwNQ==","diff_hunk":"@@ -165,24 +166,58 @@ namespace ngraph\n \n                     auto scale_const_op =\n                         std::dynamic_pointer_cast<ngraph::op::Constant>(quantize->get_argument(1));\n+                    std::vector<float> scales;\n                     if (scale_const_op == nullptr)\n                     {\n-                        throw ngraph_error(\"Quantize scale must be a constant\");\n-                    }\n-                    auto scale = scale_const_op->get_vector<float>();\n+                        auto& arg1_tensor = external_function->get_tensor_data(args[1].get_name());\n+                        auto scales_size = shape_size(args[1].get_shape());\n \n-                    std::vector<float> scales;\n-                    scales.push_back(1.0 / scale[0]);\n-                    size_t quantize_index =\n-                        mkldnn_emitter->build_quantize_reorder(input_desc, result_desc, scales);\n-                    auto& deps = mkldnn_emitter->get_primitive_deps(quantize_index);\n-                    auto functor = [&, quantize_index](CPURuntimeContext* ctx,\n-                                                       CPUExecutionContext* ectx) {\n-                        cpu::mkldnn_utils::set_memory_ptr(ctx, deps[0], arg0_tensor);\n-                        cpu::mkldnn_utils::set_memory_ptr(ctx, deps[1], out_tensor);\n-                        cpu::mkldnn_utils::mkldnn_invoke_primitive(ctx, quantize_index);\n-                    };\n-                    functors.emplace_back(functor);\n+                        // Dummy value while we wait for the actual values that are provided during\n+                        // execution\n+                        scales.push_back(1.0f);\n+                        size_t quantize_index =\n+                            mkldnn_emitter->build_quantize_reorder(input_desc, result_desc, scales);\n+                        auto& deps = mkldnn_emitter->get_primitive_deps(quantize_index);\n+                        auto functor = [&, input_desc, result_desc, scales_size](\n+                            CPURuntimeContext* ctx, CPUExecutionContext* ectx) {\n+                            // Create MKLDNN reorder primitive during the first iteration.\n+                            // Assumes the scales dont change for the duration of the graph\n+                            static mkldnn::reorder r_prim = [&]() {","path":"src/ngraph/runtime/cpu/builder/quantization.cpp","position":43,"original_position":43,"commit_id":"b58c1636af0b6e74f2689e636d0ede7f5b991fbe","original_commit_id":"b58c1636af0b6e74f2689e636d0ede7f5b991fbe","user":{"login":"nbpatel","id":22088168,"node_id":"MDQ6VXNlcjIyMDg4MTY4","avatar_url":"https://avatars3.githubusercontent.com/u/22088168?v=4","gravatar_id":"","url":"https://api.github.com/users/nbpatel","html_url":"https://github.com/nbpatel","followers_url":"https://api.github.com/users/nbpatel/followers","following_url":"https://api.github.com/users/nbpatel/following{/other_user}","gists_url":"https://api.github.com/users/nbpatel/gists{/gist_id}","starred_url":"https://api.github.com/users/nbpatel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbpatel/subscriptions","organizations_url":"https://api.github.com/users/nbpatel/orgs","repos_url":"https://api.github.com/users/nbpatel/repos","events_url":"https://api.github.com/users/nbpatel/events{/privacy}","received_events_url":"https://api.github.com/users/nbpatel/received_events","type":"User","site_admin":false},"body":"Won't we need to add the same stuff for Codegen as well?","created_at":"2018-11-12T21:52:07Z","updated_at":"2018-11-12T21:52:21Z","html_url":"https://github.com/NervanaSystems/ngraph/pull/2042#discussion_r232824705","pull_request_url":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/2042","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/comments/232824705"},"html":{"href":"https://github.com/NervanaSystems/ngraph/pull/2042#discussion_r232824705"},"pull_request":{"href":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/2042"}}},"pull_request":{"url":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/2042","id":229855693,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5ODU1Njkz","html_url":"https://github.com/NervanaSystems/ngraph/pull/2042","diff_url":"https://github.com/NervanaSystems/ngraph/pull/2042.diff","patch_url":"https://github.com/NervanaSystems/ngraph/pull/2042.patch","issue_url":"https://api.github.com/repos/NervanaSystems/ngraph/issues/2042","number":2042,"state":"open","locked":false,"title":"Support dynamic scales for quantization in the CPU backend","user":{"login":"jbobba","id":21375855,"node_id":"MDQ6VXNlcjIxMzc1ODU1","avatar_url":"https://avatars1.githubusercontent.com/u/21375855?v=4","gravatar_id":"","url":"https://api.github.com/users/jbobba","html_url":"https://github.com/jbobba","followers_url":"https://api.github.com/users/jbobba/followers","following_url":"https://api.github.com/users/jbobba/following{/other_user}","gists_url":"https://api.github.com/users/jbobba/gists{/gist_id}","starred_url":"https://api.github.com/users/jbobba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbobba/subscriptions","organizations_url":"https://api.github.com/users/jbobba/orgs","repos_url":"https://api.github.com/users/jbobba/repos","events_url":"https://api.github.com/users/jbobba/events{/privacy}","received_events_url":"https://api.github.com/users/jbobba/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-10T00:34:31Z","updated_at":"2018-11-12T21:52:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f9b99bf1c83c42d95462f29ce041512f80a24be6","assignee":null,"assignees":[],"requested_reviewers":[{"login":"Krovatkin","id":5086322,"node_id":"MDQ6VXNlcjUwODYzMjI=","avatar_url":"https://avatars0.githubusercontent.com/u/5086322?v=4","gravatar_id":"","url":"https://api.github.com/users/Krovatkin","html_url":"https://github.com/Krovatkin","followers_url":"https://api.github.com/users/Krovatkin/followers","following_url":"https://api.github.com/users/Krovatkin/following{/other_user}","gists_url":"https://api.github.com/users/Krovatkin/gists{/gist_id}","starred_url":"https://api.github.com/users/Krovatkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Krovatkin/subscriptions","organizations_url":"https://api.github.com/users/Krovatkin/orgs","repos_url":"https://api.github.com/users/Krovatkin/repos","events_url":"https://api.github.com/users/Krovatkin/events{/privacy}","received_events_url":"https://api.github.com/users/Krovatkin/received_events","type":"User","site_admin":false},{"login":"adstraw","id":26910851,"node_id":"MDQ6VXNlcjI2OTEwODUx","avatar_url":"https://avatars1.githubusercontent.com/u/26910851?v=4","gravatar_id":"","url":"https://api.github.com/users/adstraw","html_url":"https://github.com/adstraw","followers_url":"https://api.github.com/users/adstraw/followers","following_url":"https://api.github.com/users/adstraw/following{/other_user}","gists_url":"https://api.github.com/users/adstraw/gists{/gist_id}","starred_url":"https://api.github.com/users/adstraw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adstraw/subscriptions","organizations_url":"https://api.github.com/users/adstraw/orgs","repos_url":"https://api.github.com/users/adstraw/repos","events_url":"https://api.github.com/users/adstraw/events{/privacy}","received_events_url":"https://api.github.com/users/adstraw/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":1117374376,"node_id":"MDU6TGFiZWwxMTE3Mzc0Mzc2","url":"https://api.github.com/repos/NervanaSystems/ngraph/labels/IntelCPU","name":"IntelCPU","color":"a9f9f3","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/2042/commits","review_comments_url":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/2042/comments","review_comment_url":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NervanaSystems/ngraph/issues/2042/comments","statuses_url":"https://api.github.com/repos/NervanaSystems/ngraph/statuses/b58c1636af0b6e74f2689e636d0ede7f5b991fbe","head":{"label":"NervanaSystems:jbobba/quantize-non-const","ref":"jbobba/quantize-non-const","sha":"b58c1636af0b6e74f2689e636d0ede7f5b991fbe","user":{"login":"NervanaSystems","id":9260121,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkyNjAxMjE=","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":98252973,"node_id":"MDEwOlJlcG9zaXRvcnk5ODI1Mjk3Mw==","name":"ngraph","full_name":"NervanaSystems/ngraph","private":false,"owner":{"login":"NervanaSystems","id":9260121,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkyNjAxMjE=","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},"html_url":"https://github.com/NervanaSystems/ngraph","description":"nGraph is an open source C++ library, compiler and runtime for Deep Learning frameworks","fork":false,"url":"https://api.github.com/repos/NervanaSystems/ngraph","forks_url":"https://api.github.com/repos/NervanaSystems/ngraph/forks","keys_url":"https://api.github.com/repos/NervanaSystems/ngraph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NervanaSystems/ngraph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NervanaSystems/ngraph/teams","hooks_url":"https://api.github.com/repos/NervanaSystems/ngraph/hooks","issue_events_url":"https://api.github.com/repos/NervanaSystems/ngraph/issues/events{/number}","events_url":"https://api.github.com/repos/NervanaSystems/ngraph/events","assignees_url":"https://api.github.com/repos/NervanaSystems/ngraph/assignees{/user}","branches_url":"https://api.github.com/repos/NervanaSystems/ngraph/branches{/branch}","tags_url":"https://api.github.com/repos/NervanaSystems/ngraph/tags","blobs_url":"https://api.github.com/repos/NervanaSystems/ngraph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NervanaSystems/ngraph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NervanaSystems/ngraph/git/refs{/sha}","trees_url":"https://api.github.com/repos/NervanaSystems/ngraph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NervanaSystems/ngraph/statuses/{sha}","languages_url":"https://api.github.com/repos/NervanaSystems/ngraph/languages","stargazers_url":"https://api.github.com/repos/NervanaSystems/ngraph/stargazers","contributors_url":"https://api.github.com/repos/NervanaSystems/ngraph/contributors","subscribers_url":"https://api.github.com/repos/NervanaSystems/ngraph/subscribers","subscription_url":"https://api.github.com/repos/NervanaSystems/ngraph/subscription","commits_url":"https://api.github.com/repos/NervanaSystems/ngraph/commits{/sha}","git_commits_url":"https://api.github.com/repos/NervanaSystems/ngraph/git/commits{/sha}","comments_url":"https://api.github.com/repos/NervanaSystems/ngraph/comments{/number}","issue_comment_url":"https://api.github.com/repos/NervanaSystems/ngraph/issues/comments{/number}","contents_url":"https://api.github.com/repos/NervanaSystems/ngraph/contents/{+path}","compare_url":"https://api.github.com/repos/NervanaSystems/ngraph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NervanaSystems/ngraph/merges","archive_url":"https://api.github.com/repos/NervanaSystems/ngraph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NervanaSystems/ngraph/downloads","issues_url":"https://api.github.com/repos/NervanaSystems/ngraph/issues{/number}","pulls_url":"https://api.github.com/repos/NervanaSystems/ngraph/pulls{/number}","milestones_url":"https://api.github.com/repos/NervanaSystems/ngraph/milestones{/number}","notifications_url":"https://api.github.com/repos/NervanaSystems/ngraph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NervanaSystems/ngraph/labels{/name}","releases_url":"https://api.github.com/repos/NervanaSystems/ngraph/releases{/id}","deployments_url":"https://api.github.com/repos/NervanaSystems/ngraph/deployments","created_at":"2017-07-25T02:02:38Z","updated_at":"2018-11-12T20:45:00Z","pushed_at":"2018-11-12T20:45:55Z","git_url":"git://github.com/NervanaSystems/ngraph.git","ssh_url":"git@github.com:NervanaSystems/ngraph.git","clone_url":"https://github.com/NervanaSystems/ngraph.git","svn_url":"https://github.com/NervanaSystems/ngraph","homepage":"http://ngraph.nervanasys.com/docs/latest","size":40098,"stargazers_count":654,"watchers_count":654,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"archived":false,"open_issues_count":78,"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":90,"open_issues":78,"watchers":654,"default_branch":"master"}},"base":{"label":"NervanaSystems:master","ref":"master","sha":"2fc73b437f350745c9ae8afc344e61d1499939b1","user":{"login":"NervanaSystems","id":9260121,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkyNjAxMjE=","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":98252973,"node_id":"MDEwOlJlcG9zaXRvcnk5ODI1Mjk3Mw==","name":"ngraph","full_name":"NervanaSystems/ngraph","private":false,"owner":{"login":"NervanaSystems","id":9260121,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkyNjAxMjE=","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},"html_url":"https://github.com/NervanaSystems/ngraph","description":"nGraph is an open source C++ library, compiler and runtime for Deep Learning frameworks","fork":false,"url":"https://api.github.com/repos/NervanaSystems/ngraph","forks_url":"https://api.github.com/repos/NervanaSystems/ngraph/forks","keys_url":"https://api.github.com/repos/NervanaSystems/ngraph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NervanaSystems/ngraph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NervanaSystems/ngraph/teams","hooks_url":"https://api.github.com/repos/NervanaSystems/ngraph/hooks","issue_events_url":"https://api.github.com/repos/NervanaSystems/ngraph/issues/events{/number}","events_url":"https://api.github.com/repos/NervanaSystems/ngraph/events","assignees_url":"https://api.github.com/repos/NervanaSystems/ngraph/assignees{/user}","branches_url":"https://api.github.com/repos/NervanaSystems/ngraph/branches{/branch}","tags_url":"https://api.github.com/repos/NervanaSystems/ngraph/tags","blobs_url":"https://api.github.com/repos/NervanaSystems/ngraph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NervanaSystems/ngraph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NervanaSystems/ngraph/git/refs{/sha}","trees_url":"https://api.github.com/repos/NervanaSystems/ngraph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NervanaSystems/ngraph/statuses/{sha}","languages_url":"https://api.github.com/repos/NervanaSystems/ngraph/languages","stargazers_url":"https://api.github.com/repos/NervanaSystems/ngraph/stargazers","contributors_url":"https://api.github.com/repos/NervanaSystems/ngraph/contributors","subscribers_url":"https://api.github.com/repos/NervanaSystems/ngraph/subscribers","subscription_url":"https://api.github.com/repos/NervanaSystems/ngraph/subscription","commits_url":"https://api.github.com/repos/NervanaSystems/ngraph/commits{/sha}","git_commits_url":"https://api.github.com/repos/NervanaSystems/ngraph/git/commits{/sha}","comments_url":"https://api.github.com/repos/NervanaSystems/ngraph/comments{/number}","issue_comment_url":"https://api.github.com/repos/NervanaSystems/ngraph/issues/comments{/number}","contents_url":"https://api.github.com/repos/NervanaSystems/ngraph/contents/{+path}","compare_url":"https://api.github.com/repos/NervanaSystems/ngraph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NervanaSystems/ngraph/merges","archive_url":"https://api.github.com/repos/NervanaSystems/ngraph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NervanaSystems/ngraph/downloads","issues_url":"https://api.github.com/repos/NervanaSystems/ngraph/issues{/number}","pulls_url":"https://api.github.com/repos/NervanaSystems/ngraph/pulls{/number}","milestones_url":"https://api.github.com/repos/NervanaSystems/ngraph/milestones{/number}","notifications_url":"https://api.github.com/repos/NervanaSystems/ngraph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NervanaSystems/ngraph/labels{/name}","releases_url":"https://api.github.com/repos/NervanaSystems/ngraph/releases{/id}","deployments_url":"https://api.github.com/repos/NervanaSystems/ngraph/deployments","created_at":"2017-07-25T02:02:38Z","updated_at":"2018-11-12T20:45:00Z","pushed_at":"2018-11-12T20:45:55Z","git_url":"git://github.com/NervanaSystems/ngraph.git","ssh_url":"git@github.com:NervanaSystems/ngraph.git","clone_url":"https://github.com/NervanaSystems/ngraph.git","svn_url":"https://github.com/NervanaSystems/ngraph","homepage":"http://ngraph.nervanasys.com/docs/latest","size":40098,"stargazers_count":654,"watchers_count":654,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"archived":false,"open_issues_count":78,"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":90,"open_issues":78,"watchers":654,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/2042"},"html":{"href":"https://github.com/NervanaSystems/ngraph/pull/2042"},"issue":{"href":"https://api.github.com/repos/NervanaSystems/ngraph/issues/2042"},"comments":{"href":"https://api.github.com/repos/NervanaSystems/ngraph/issues/2042/comments"},"review_comments":{"href":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/2042/comments"},"review_comment":{"href":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NervanaSystems/ngraph/pulls/2042/commits"},"statuses":{"href":"https://api.github.com/repos/NervanaSystems/ngraph/statuses/b58c1636af0b6e74f2689e636d0ede7f5b991fbe"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nbpatel"}}