{"action":"created","comment":{"url":"https://api.github.com/repos/pytorch/glow/pulls/comments/236463757","pull_request_review_id":178545216,"id":236463757,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjQ2Mzc1Nw==","diff_hunk":"@@ -201,10 +199,70 @@ void Caffe2ModelLoader::loadOperator(const caffe2::OperatorDef &op) {\n         calculateConvPoolOutputDims(idim.h, idim.w, kernels, strides, pads);\n     std::array<size_t, 4> outDims = {\n         {idim.n, outSz.first, outSz.second, depth}};\n-    auto outTy = G_.getParent()->uniqueType(ElemKind::FloatTy, outDims);\n+\n+    TypeRef outTy;\n+    Constant *filter;\n+    Constant *bias;\n+    if (typeName == \"Conv\") {\n+      // Construct the Bias field.\n+      Tensor biasTensor(ElemKind::FloatTy, {depth});\n+      biasTensor.zero();\n+\n+      // Check if we have a serialized bias vector.\n+      if (op.input_size() > 2) {\n+        auto &biasTensorName = op.input(2);\n+        if (tensors_.count(biasTensorName)) {\n+          // Load the serialized bias vector.\n+          Tensor *b = getTensorByName(biasTensorName);\n+          biasTensor.assign(b);\n+        }\n+      }\n+      outTy = G_.getParent()->uniqueType(ElemKind::FloatTy, outDims);\n+      filter = G_.getParent()->createConstant(\"conv.filter\", wtag);\n+      bias = G_.getParent()->createConstant(\"conv.bias\", biasTensor);\n+    } else {\n+      assert(dict.count(\"Y_zero_point\") &&\n+             \"missing zero point for quantzied type\");","path":"lib/Importer/Caffe2ModelLoader.cpp","position":97,"original_position":97,"commit_id":"491159eaf9027bf464114b890b9464af8f784765","original_commit_id":"037e48086fb4a1b43aa24829cb41780d4db3143d","user":{"login":"rdzhabarov","id":34466929,"node_id":"MDQ6VXNlcjM0NDY2OTI5","avatar_url":"https://avatars0.githubusercontent.com/u/34466929?v=4","gravatar_id":"","url":"https://api.github.com/users/rdzhabarov","html_url":"https://github.com/rdzhabarov","followers_url":"https://api.github.com/users/rdzhabarov/followers","following_url":"https://api.github.com/users/rdzhabarov/following{/other_user}","gists_url":"https://api.github.com/users/rdzhabarov/gists{/gist_id}","starred_url":"https://api.github.com/users/rdzhabarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdzhabarov/subscriptions","organizations_url":"https://api.github.com/users/rdzhabarov/orgs","repos_url":"https://api.github.com/users/rdzhabarov/repos","events_url":"https://api.github.com/users/rdzhabarov/events{/privacy}","received_events_url":"https://api.github.com/users/rdzhabarov/received_events","type":"User","site_admin":false},"body":"yeah, i was referring to `\"missing zero point for quantzied type\"`\r\njust to clarify that it's for the output type etc.","created_at":"2018-11-26T23:10:44Z","updated_at":"2018-11-26T23:10:44Z","html_url":"https://github.com/pytorch/glow/pull/2016#discussion_r236463757","pull_request_url":"https://api.github.com/repos/pytorch/glow/pulls/2016","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pytorch/glow/pulls/comments/236463757"},"html":{"href":"https://github.com/pytorch/glow/pull/2016#discussion_r236463757"},"pull_request":{"href":"https://api.github.com/repos/pytorch/glow/pulls/2016"}},"in_reply_to_id":236445498},"pull_request":{"url":"https://api.github.com/repos/pytorch/glow/pulls/2016","id":230658162,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwNjU4MTYy","html_url":"https://github.com/pytorch/glow/pull/2016","diff_url":"https://github.com/pytorch/glow/pull/2016.diff","patch_url":"https://github.com/pytorch/glow/pull/2016.patch","issue_url":"https://api.github.com/repos/pytorch/glow/issues/2016","number":2016,"state":"open","locked":false,"title":"[Quantization] Load quantized resnet50 model","user":{"login":"beicy","id":37386895,"node_id":"MDQ6VXNlcjM3Mzg2ODk1","avatar_url":"https://avatars0.githubusercontent.com/u/37386895?v=4","gravatar_id":"","url":"https://api.github.com/users/beicy","html_url":"https://github.com/beicy","followers_url":"https://api.github.com/users/beicy/followers","following_url":"https://api.github.com/users/beicy/following{/other_user}","gists_url":"https://api.github.com/users/beicy/gists{/gist_id}","starred_url":"https://api.github.com/users/beicy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beicy/subscriptions","organizations_url":"https://api.github.com/users/beicy/orgs","repos_url":"https://api.github.com/users/beicy/repos","events_url":"https://api.github.com/users/beicy/events{/privacy}","received_events_url":"https://api.github.com/users/beicy/received_events","type":"User","site_admin":false},"body":"*Description*:\r\nThis PR finished the rest work of loading Caffe2 quantized Resnet50 model discussed in #1727.\r\nThe model can be found here : https://github.com/caffe2/models/tree/master/resnet50_quantized\r\nFor testing in Glow side, the model can be downloaded by running utils/download_caffe2_models.sh.\r\n\r\n*Testing*:\r\nadded quantized ResNet50 to Glow's test suite (run.sh), tested for interpreter and cpu backend.\r\n```\r\n File: tests/images/imagenet/cat_285.png\tLabel-K1: 281 (probability: 0.7541)\r\n File: tests/images/imagenet/dog_207.png\tLabel-K1: 207 (probability: 0.9583)\r\n File: tests/images/imagenet/zebra_340.png\tLabel-K1: 340 (probability: 0.9952)\r\n```\r\n\r\n*Documentation*:\r\n[Optional Fixes #1762 #1727]\r\n\r\nPlease see a detailed explanation of how to fill out the fields in the relevant sections in PULL_REQUEST.md.\r\n","created_at":"2018-11-13T23:15:00Z","updated_at":"2018-11-26T23:10:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cdff7c6ac2be46492c232bf01c5c2090a1f2e451","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":706497924,"node_id":"MDU6TGFiZWw3MDY0OTc5MjQ=","url":"https://api.github.com/repos/pytorch/glow/labels/CLA%20Signed","name":"CLA Signed","color":"009900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/pytorch/glow/pulls/2016/commits","review_comments_url":"https://api.github.com/repos/pytorch/glow/pulls/2016/comments","review_comment_url":"https://api.github.com/repos/pytorch/glow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pytorch/glow/issues/2016/comments","statuses_url":"https://api.github.com/repos/pytorch/glow/statuses/491159eaf9027bf464114b890b9464af8f784765","head":{"label":"beicy:expr1","ref":"expr1","sha":"491159eaf9027bf464114b890b9464af8f784765","user":{"login":"beicy","id":37386895,"node_id":"MDQ6VXNlcjM3Mzg2ODk1","avatar_url":"https://avatars0.githubusercontent.com/u/37386895?v=4","gravatar_id":"","url":"https://api.github.com/users/beicy","html_url":"https://github.com/beicy","followers_url":"https://api.github.com/users/beicy/followers","following_url":"https://api.github.com/users/beicy/following{/other_user}","gists_url":"https://api.github.com/users/beicy/gists{/gist_id}","starred_url":"https://api.github.com/users/beicy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beicy/subscriptions","organizations_url":"https://api.github.com/users/beicy/orgs","repos_url":"https://api.github.com/users/beicy/repos","events_url":"https://api.github.com/users/beicy/events{/privacy}","received_events_url":"https://api.github.com/users/beicy/received_events","type":"User","site_admin":false},"repo":{"id":132027958,"node_id":"MDEwOlJlcG9zaXRvcnkxMzIwMjc5NTg=","name":"glow","full_name":"beicy/glow","private":false,"owner":{"login":"beicy","id":37386895,"node_id":"MDQ6VXNlcjM3Mzg2ODk1","avatar_url":"https://avatars0.githubusercontent.com/u/37386895?v=4","gravatar_id":"","url":"https://api.github.com/users/beicy","html_url":"https://github.com/beicy","followers_url":"https://api.github.com/users/beicy/followers","following_url":"https://api.github.com/users/beicy/following{/other_user}","gists_url":"https://api.github.com/users/beicy/gists{/gist_id}","starred_url":"https://api.github.com/users/beicy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beicy/subscriptions","organizations_url":"https://api.github.com/users/beicy/orgs","repos_url":"https://api.github.com/users/beicy/repos","events_url":"https://api.github.com/users/beicy/events{/privacy}","received_events_url":"https://api.github.com/users/beicy/received_events","type":"User","site_admin":false},"html_url":"https://github.com/beicy/glow","description":"Compiler for Neural Network hardware accelerators","fork":true,"url":"https://api.github.com/repos/beicy/glow","forks_url":"https://api.github.com/repos/beicy/glow/forks","keys_url":"https://api.github.com/repos/beicy/glow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/beicy/glow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/beicy/glow/teams","hooks_url":"https://api.github.com/repos/beicy/glow/hooks","issue_events_url":"https://api.github.com/repos/beicy/glow/issues/events{/number}","events_url":"https://api.github.com/repos/beicy/glow/events","assignees_url":"https://api.github.com/repos/beicy/glow/assignees{/user}","branches_url":"https://api.github.com/repos/beicy/glow/branches{/branch}","tags_url":"https://api.github.com/repos/beicy/glow/tags","blobs_url":"https://api.github.com/repos/beicy/glow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/beicy/glow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/beicy/glow/git/refs{/sha}","trees_url":"https://api.github.com/repos/beicy/glow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/beicy/glow/statuses/{sha}","languages_url":"https://api.github.com/repos/beicy/glow/languages","stargazers_url":"https://api.github.com/repos/beicy/glow/stargazers","contributors_url":"https://api.github.com/repos/beicy/glow/contributors","subscribers_url":"https://api.github.com/repos/beicy/glow/subscribers","subscription_url":"https://api.github.com/repos/beicy/glow/subscription","commits_url":"https://api.github.com/repos/beicy/glow/commits{/sha}","git_commits_url":"https://api.github.com/repos/beicy/glow/git/commits{/sha}","comments_url":"https://api.github.com/repos/beicy/glow/comments{/number}","issue_comment_url":"https://api.github.com/repos/beicy/glow/issues/comments{/number}","contents_url":"https://api.github.com/repos/beicy/glow/contents/{+path}","compare_url":"https://api.github.com/repos/beicy/glow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/beicy/glow/merges","archive_url":"https://api.github.com/repos/beicy/glow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/beicy/glow/downloads","issues_url":"https://api.github.com/repos/beicy/glow/issues{/number}","pulls_url":"https://api.github.com/repos/beicy/glow/pulls{/number}","milestones_url":"https://api.github.com/repos/beicy/glow/milestones{/number}","notifications_url":"https://api.github.com/repos/beicy/glow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/beicy/glow/labels{/name}","releases_url":"https://api.github.com/repos/beicy/glow/releases{/id}","deployments_url":"https://api.github.com/repos/beicy/glow/deployments","created_at":"2018-05-03T17:23:58Z","updated_at":"2018-05-07T22:51:35Z","pushed_at":"2018-11-26T22:58:56Z","git_url":"git://github.com/beicy/glow.git","ssh_url":"git@github.com:beicy/glow.git","clone_url":"https://github.com/beicy/glow.git","svn_url":"https://github.com/beicy/glow","homepage":null,"size":10188,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":"pytorch:master","ref":"master","sha":"48f4c0d718f875b775434f44e37a0487b9b5ce6c","user":{"login":"pytorch","id":21003710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDAzNzEw","avatar_url":"https://avatars3.githubusercontent.com/u/21003710?v=4","gravatar_id":"","url":"https://api.github.com/users/pytorch","html_url":"https://github.com/pytorch","followers_url":"https://api.github.com/users/pytorch/followers","following_url":"https://api.github.com/users/pytorch/following{/other_user}","gists_url":"https://api.github.com/users/pytorch/gists{/gist_id}","starred_url":"https://api.github.com/users/pytorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytorch/subscriptions","organizations_url":"https://api.github.com/users/pytorch/orgs","repos_url":"https://api.github.com/users/pytorch/repos","events_url":"https://api.github.com/users/pytorch/events{/privacy}","received_events_url":"https://api.github.com/users/pytorch/received_events","type":"Organization","site_admin":false},"repo":{"id":105281531,"node_id":"MDEwOlJlcG9zaXRvcnkxMDUyODE1MzE=","name":"glow","full_name":"pytorch/glow","private":false,"owner":{"login":"pytorch","id":21003710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDAzNzEw","avatar_url":"https://avatars3.githubusercontent.com/u/21003710?v=4","gravatar_id":"","url":"https://api.github.com/users/pytorch","html_url":"https://github.com/pytorch","followers_url":"https://api.github.com/users/pytorch/followers","following_url":"https://api.github.com/users/pytorch/following{/other_user}","gists_url":"https://api.github.com/users/pytorch/gists{/gist_id}","starred_url":"https://api.github.com/users/pytorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytorch/subscriptions","organizations_url":"https://api.github.com/users/pytorch/orgs","repos_url":"https://api.github.com/users/pytorch/repos","events_url":"https://api.github.com/users/pytorch/events{/privacy}","received_events_url":"https://api.github.com/users/pytorch/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pytorch/glow","description":"Compiler for Neural Network hardware accelerators","fork":false,"url":"https://api.github.com/repos/pytorch/glow","forks_url":"https://api.github.com/repos/pytorch/glow/forks","keys_url":"https://api.github.com/repos/pytorch/glow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pytorch/glow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pytorch/glow/teams","hooks_url":"https://api.github.com/repos/pytorch/glow/hooks","issue_events_url":"https://api.github.com/repos/pytorch/glow/issues/events{/number}","events_url":"https://api.github.com/repos/pytorch/glow/events","assignees_url":"https://api.github.com/repos/pytorch/glow/assignees{/user}","branches_url":"https://api.github.com/repos/pytorch/glow/branches{/branch}","tags_url":"https://api.github.com/repos/pytorch/glow/tags","blobs_url":"https://api.github.com/repos/pytorch/glow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pytorch/glow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pytorch/glow/git/refs{/sha}","trees_url":"https://api.github.com/repos/pytorch/glow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pytorch/glow/statuses/{sha}","languages_url":"https://api.github.com/repos/pytorch/glow/languages","stargazers_url":"https://api.github.com/repos/pytorch/glow/stargazers","contributors_url":"https://api.github.com/repos/pytorch/glow/contributors","subscribers_url":"https://api.github.com/repos/pytorch/glow/subscribers","subscription_url":"https://api.github.com/repos/pytorch/glow/subscription","commits_url":"https://api.github.com/repos/pytorch/glow/commits{/sha}","git_commits_url":"https://api.github.com/repos/pytorch/glow/git/commits{/sha}","comments_url":"https://api.github.com/repos/pytorch/glow/comments{/number}","issue_comment_url":"https://api.github.com/repos/pytorch/glow/issues/comments{/number}","contents_url":"https://api.github.com/repos/pytorch/glow/contents/{+path}","compare_url":"https://api.github.com/repos/pytorch/glow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pytorch/glow/merges","archive_url":"https://api.github.com/repos/pytorch/glow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pytorch/glow/downloads","issues_url":"https://api.github.com/repos/pytorch/glow/issues{/number}","pulls_url":"https://api.github.com/repos/pytorch/glow/pulls{/number}","milestones_url":"https://api.github.com/repos/pytorch/glow/milestones{/number}","notifications_url":"https://api.github.com/repos/pytorch/glow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pytorch/glow/labels{/name}","releases_url":"https://api.github.com/repos/pytorch/glow/releases{/id}","deployments_url":"https://api.github.com/repos/pytorch/glow/deployments","created_at":"2017-09-29T14:28:18Z","updated_at":"2018-11-26T19:01:01Z","pushed_at":"2018-11-26T22:58:59Z","git_url":"git://github.com/pytorch/glow.git","ssh_url":"git@github.com:pytorch/glow.git","clone_url":"https://github.com/pytorch/glow.git","svn_url":"https://github.com/pytorch/glow","homepage":null,"size":10167,"stargazers_count":1045,"watchers_count":1045,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":138,"mirror_url":null,"archived":false,"open_issues_count":79,"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":138,"open_issues":79,"watchers":1045,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pytorch/glow/pulls/2016"},"html":{"href":"https://github.com/pytorch/glow/pull/2016"},"issue":{"href":"https://api.github.com/repos/pytorch/glow/issues/2016"},"comments":{"href":"https://api.github.com/repos/pytorch/glow/issues/2016/comments"},"review_comments":{"href":"https://api.github.com/repos/pytorch/glow/pulls/2016/comments"},"review_comment":{"href":"https://api.github.com/repos/pytorch/glow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pytorch/glow/pulls/2016/commits"},"statuses":{"href":"https://api.github.com/repos/pytorch/glow/statuses/491159eaf9027bf464114b890b9464af8f784765"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"rdzhabarov"}}