{"action":"created","comment":{"url":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/comments/203887906","pull_request_review_id":138870330,"id":203887906,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzg4NzkwNg==","diff_hunk":"@@ -0,0 +1,83 @@\n+#include \"onnx_xla/operator_registry.h\"\n+\n+namespace onnx_xla {\n+// TODO: ENFORCE_EQ macro\n+// Takes in data tensor and shape input\n+// Error if shape input is dynamic\n+// Parses ONNX shape input (can have 0's and one -1)\n+// Produces new_sizes attribute to make XlaOp for Reshape\n+onnxStatus translateReshape(const Node& n,\n+                            XlaBuilder& builder,\n+                            ValueOpMap& valueToOp,\n+                            const ValueLiteralMap& valueToLiteral) {\n+  // Check if shape input is static\n+  auto shapeDataIt = valueToLiteral.find(n.inputs().at(1));\n+  if (shapeDataIt == valueToLiteral.end()) {  // TODO: ENFORCE_EQ\n+    std::cerr << \"Reshape operatore having dynamic shape input is not supported\"\n+              << std::endl;\n+    return ONNXIFI_STATUS_UNSUPPORTED_VERSION;\n+  }\n+  // Compute # of elements in input data tensor (check validity of shapes)\n+  const std::vector<Dimension>& originalShape = n.inputs().at(0)->sizes();\n+  int64_t numElements = 1;\n+  for (const auto& dimension : originalShape) {\n+    if (!dimension.is_int) {\n+      std::cerr << \"Reshape operator input data shape is not known\"\n+                << std::endl;\n+      return ONNXIFI_STATUS_UNSUPPORTED_SHAPE;\n+    }\n+    numElements *= dimension.dim;\n+  }\n+\n+  // Use static ONNX target shape data (from the constant literal constructed)\n+  // to build XLA target shape data and compute xlaProduct (product of shape\n+  // constructed)\n+  const tensorflow::gtl::ArraySlice<int64> onnxOperatorTargetShape =\n+      shapeDataIt->second->data<int64>();\n+  std::vector<int64> xlaOperatorTargetShape;\n+  int64 xlaProduct = 1;","path":"onnx_xla/translations/translate_reshape.cc","position":38,"original_position":38,"commit_id":"d4746db7ee20d7e1d54c86a0eaade88a2055e613","original_commit_id":"d4746db7ee20d7e1d54c86a0eaade88a2055e613","user":{"login":"varunjain99","id":20483346,"node_id":"MDQ6VXNlcjIwNDgzMzQ2","avatar_url":"https://avatars1.githubusercontent.com/u/20483346?v=4","gravatar_id":"","url":"https://api.github.com/users/varunjain99","html_url":"https://github.com/varunjain99","followers_url":"https://api.github.com/users/varunjain99/followers","following_url":"https://api.github.com/users/varunjain99/following{/other_user}","gists_url":"https://api.github.com/users/varunjain99/gists{/gist_id}","starred_url":"https://api.github.com/users/varunjain99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varunjain99/subscriptions","organizations_url":"https://api.github.com/users/varunjain99/orgs","repos_url":"https://api.github.com/users/varunjain99/repos","events_url":"https://api.github.com/users/varunjain99/events{/privacy}","received_events_url":"https://api.github.com/users/varunjain99/received_events","type":"User","site_admin":false},"body":"Taking product over vector of int64, so thought int64 more appropriate than int64_t","created_at":"2018-07-19T22:08:35Z","updated_at":"2018-07-19T22:08:35Z","html_url":"https://github.com/varunjain99/onnx-xla/pull/16#discussion_r203887906","pull_request_url":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/16","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/comments/203887906"},"html":{"href":"https://github.com/varunjain99/onnx-xla/pull/16#discussion_r203887906"},"pull_request":{"href":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/16"}},"in_reply_to_id":203872462},"pull_request":{"url":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/16","id":202112414,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyMTEyNDE0","html_url":"https://github.com/varunjain99/onnx-xla/pull/16","diff_url":"https://github.com/varunjain99/onnx-xla/pull/16.diff","patch_url":"https://github.com/varunjain99/onnx-xla/pull/16.patch","issue_url":"https://api.github.com/repos/varunjain99/onnx-xla/issues/16","number":16,"state":"open","locked":false,"title":"Reshape operator","user":{"login":"varunjain99","id":20483346,"node_id":"MDQ6VXNlcjIwNDgzMzQ2","avatar_url":"https://avatars1.githubusercontent.com/u/20483346?v=4","gravatar_id":"","url":"https://api.github.com/users/varunjain99","html_url":"https://github.com/varunjain99","followers_url":"https://api.github.com/users/varunjain99/followers","following_url":"https://api.github.com/users/varunjain99/following{/other_user}","gists_url":"https://api.github.com/users/varunjain99/gists{/gist_id}","starred_url":"https://api.github.com/users/varunjain99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varunjain99/subscriptions","organizations_url":"https://api.github.com/users/varunjain99/orgs","repos_url":"https://api.github.com/users/varunjain99/repos","events_url":"https://api.github.com/users/varunjain99/events{/privacy}","received_events_url":"https://api.github.com/users/varunjain99/received_events","type":"User","site_admin":false},"body":"Translation for reshape\r\n1) Added map from value to constant literal to use in translations (useful if need initializer data for the translation)\r\n2) functionality for reshape translation\r\n@bddppq @yinghai @Maratyszcza","created_at":"2018-07-18T01:01:20Z","updated_at":"2018-07-19T22:08:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a1473860e67f641be1cc8cc0eedea3dcc151916","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/16/commits","review_comments_url":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/16/comments","review_comment_url":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/comments{/number}","comments_url":"https://api.github.com/repos/varunjain99/onnx-xla/issues/16/comments","statuses_url":"https://api.github.com/repos/varunjain99/onnx-xla/statuses/d4746db7ee20d7e1d54c86a0eaade88a2055e613","head":{"label":"varunjain99:reshape_operator","ref":"reshape_operator","sha":"d4746db7ee20d7e1d54c86a0eaade88a2055e613","user":{"login":"varunjain99","id":20483346,"node_id":"MDQ6VXNlcjIwNDgzMzQ2","avatar_url":"https://avatars1.githubusercontent.com/u/20483346?v=4","gravatar_id":"","url":"https://api.github.com/users/varunjain99","html_url":"https://github.com/varunjain99","followers_url":"https://api.github.com/users/varunjain99/followers","following_url":"https://api.github.com/users/varunjain99/following{/other_user}","gists_url":"https://api.github.com/users/varunjain99/gists{/gist_id}","starred_url":"https://api.github.com/users/varunjain99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varunjain99/subscriptions","organizations_url":"https://api.github.com/users/varunjain99/orgs","repos_url":"https://api.github.com/users/varunjain99/repos","events_url":"https://api.github.com/users/varunjain99/events{/privacy}","received_events_url":"https://api.github.com/users/varunjain99/received_events","type":"User","site_admin":false},"repo":{"id":137373854,"node_id":"MDEwOlJlcG9zaXRvcnkxMzczNzM4NTQ=","name":"onnx-xla","full_name":"varunjain99/onnx-xla","owner":{"login":"varunjain99","id":20483346,"node_id":"MDQ6VXNlcjIwNDgzMzQ2","avatar_url":"https://avatars1.githubusercontent.com/u/20483346?v=4","gravatar_id":"","url":"https://api.github.com/users/varunjain99","html_url":"https://github.com/varunjain99","followers_url":"https://api.github.com/users/varunjain99/followers","following_url":"https://api.github.com/users/varunjain99/following{/other_user}","gists_url":"https://api.github.com/users/varunjain99/gists{/gist_id}","starred_url":"https://api.github.com/users/varunjain99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varunjain99/subscriptions","organizations_url":"https://api.github.com/users/varunjain99/orgs","repos_url":"https://api.github.com/users/varunjain99/repos","events_url":"https://api.github.com/users/varunjain99/events{/privacy}","received_events_url":"https://api.github.com/users/varunjain99/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/varunjain99/onnx-xla","description":null,"fork":false,"url":"https://api.github.com/repos/varunjain99/onnx-xla","forks_url":"https://api.github.com/repos/varunjain99/onnx-xla/forks","keys_url":"https://api.github.com/repos/varunjain99/onnx-xla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/varunjain99/onnx-xla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/varunjain99/onnx-xla/teams","hooks_url":"https://api.github.com/repos/varunjain99/onnx-xla/hooks","issue_events_url":"https://api.github.com/repos/varunjain99/onnx-xla/issues/events{/number}","events_url":"https://api.github.com/repos/varunjain99/onnx-xla/events","assignees_url":"https://api.github.com/repos/varunjain99/onnx-xla/assignees{/user}","branches_url":"https://api.github.com/repos/varunjain99/onnx-xla/branches{/branch}","tags_url":"https://api.github.com/repos/varunjain99/onnx-xla/tags","blobs_url":"https://api.github.com/repos/varunjain99/onnx-xla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/varunjain99/onnx-xla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/varunjain99/onnx-xla/git/refs{/sha}","trees_url":"https://api.github.com/repos/varunjain99/onnx-xla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/varunjain99/onnx-xla/statuses/{sha}","languages_url":"https://api.github.com/repos/varunjain99/onnx-xla/languages","stargazers_url":"https://api.github.com/repos/varunjain99/onnx-xla/stargazers","contributors_url":"https://api.github.com/repos/varunjain99/onnx-xla/contributors","subscribers_url":"https://api.github.com/repos/varunjain99/onnx-xla/subscribers","subscription_url":"https://api.github.com/repos/varunjain99/onnx-xla/subscription","commits_url":"https://api.github.com/repos/varunjain99/onnx-xla/commits{/sha}","git_commits_url":"https://api.github.com/repos/varunjain99/onnx-xla/git/commits{/sha}","comments_url":"https://api.github.com/repos/varunjain99/onnx-xla/comments{/number}","issue_comment_url":"https://api.github.com/repos/varunjain99/onnx-xla/issues/comments{/number}","contents_url":"https://api.github.com/repos/varunjain99/onnx-xla/contents/{+path}","compare_url":"https://api.github.com/repos/varunjain99/onnx-xla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/varunjain99/onnx-xla/merges","archive_url":"https://api.github.com/repos/varunjain99/onnx-xla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/varunjain99/onnx-xla/downloads","issues_url":"https://api.github.com/repos/varunjain99/onnx-xla/issues{/number}","pulls_url":"https://api.github.com/repos/varunjain99/onnx-xla/pulls{/number}","milestones_url":"https://api.github.com/repos/varunjain99/onnx-xla/milestones{/number}","notifications_url":"https://api.github.com/repos/varunjain99/onnx-xla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/varunjain99/onnx-xla/labels{/name}","releases_url":"https://api.github.com/repos/varunjain99/onnx-xla/releases{/id}","deployments_url":"https://api.github.com/repos/varunjain99/onnx-xla/deployments","created_at":"2018-06-14T15:04:31Z","updated_at":"2018-07-18T18:03:15Z","pushed_at":"2018-07-19T17:57:54Z","git_url":"git://github.com/varunjain99/onnx-xla.git","ssh_url":"git@github.com:varunjain99/onnx-xla.git","clone_url":"https://github.com/varunjain99/onnx-xla.git","svn_url":"https://github.com/varunjain99/onnx-xla","homepage":null,"size":133375,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":1,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"varunjain99:master","ref":"master","sha":"3ef2558146334b9e8df90eed11ca27ab405685c2","user":{"login":"varunjain99","id":20483346,"node_id":"MDQ6VXNlcjIwNDgzMzQ2","avatar_url":"https://avatars1.githubusercontent.com/u/20483346?v=4","gravatar_id":"","url":"https://api.github.com/users/varunjain99","html_url":"https://github.com/varunjain99","followers_url":"https://api.github.com/users/varunjain99/followers","following_url":"https://api.github.com/users/varunjain99/following{/other_user}","gists_url":"https://api.github.com/users/varunjain99/gists{/gist_id}","starred_url":"https://api.github.com/users/varunjain99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varunjain99/subscriptions","organizations_url":"https://api.github.com/users/varunjain99/orgs","repos_url":"https://api.github.com/users/varunjain99/repos","events_url":"https://api.github.com/users/varunjain99/events{/privacy}","received_events_url":"https://api.github.com/users/varunjain99/received_events","type":"User","site_admin":false},"repo":{"id":137373854,"node_id":"MDEwOlJlcG9zaXRvcnkxMzczNzM4NTQ=","name":"onnx-xla","full_name":"varunjain99/onnx-xla","owner":{"login":"varunjain99","id":20483346,"node_id":"MDQ6VXNlcjIwNDgzMzQ2","avatar_url":"https://avatars1.githubusercontent.com/u/20483346?v=4","gravatar_id":"","url":"https://api.github.com/users/varunjain99","html_url":"https://github.com/varunjain99","followers_url":"https://api.github.com/users/varunjain99/followers","following_url":"https://api.github.com/users/varunjain99/following{/other_user}","gists_url":"https://api.github.com/users/varunjain99/gists{/gist_id}","starred_url":"https://api.github.com/users/varunjain99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varunjain99/subscriptions","organizations_url":"https://api.github.com/users/varunjain99/orgs","repos_url":"https://api.github.com/users/varunjain99/repos","events_url":"https://api.github.com/users/varunjain99/events{/privacy}","received_events_url":"https://api.github.com/users/varunjain99/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/varunjain99/onnx-xla","description":null,"fork":false,"url":"https://api.github.com/repos/varunjain99/onnx-xla","forks_url":"https://api.github.com/repos/varunjain99/onnx-xla/forks","keys_url":"https://api.github.com/repos/varunjain99/onnx-xla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/varunjain99/onnx-xla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/varunjain99/onnx-xla/teams","hooks_url":"https://api.github.com/repos/varunjain99/onnx-xla/hooks","issue_events_url":"https://api.github.com/repos/varunjain99/onnx-xla/issues/events{/number}","events_url":"https://api.github.com/repos/varunjain99/onnx-xla/events","assignees_url":"https://api.github.com/repos/varunjain99/onnx-xla/assignees{/user}","branches_url":"https://api.github.com/repos/varunjain99/onnx-xla/branches{/branch}","tags_url":"https://api.github.com/repos/varunjain99/onnx-xla/tags","blobs_url":"https://api.github.com/repos/varunjain99/onnx-xla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/varunjain99/onnx-xla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/varunjain99/onnx-xla/git/refs{/sha}","trees_url":"https://api.github.com/repos/varunjain99/onnx-xla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/varunjain99/onnx-xla/statuses/{sha}","languages_url":"https://api.github.com/repos/varunjain99/onnx-xla/languages","stargazers_url":"https://api.github.com/repos/varunjain99/onnx-xla/stargazers","contributors_url":"https://api.github.com/repos/varunjain99/onnx-xla/contributors","subscribers_url":"https://api.github.com/repos/varunjain99/onnx-xla/subscribers","subscription_url":"https://api.github.com/repos/varunjain99/onnx-xla/subscription","commits_url":"https://api.github.com/repos/varunjain99/onnx-xla/commits{/sha}","git_commits_url":"https://api.github.com/repos/varunjain99/onnx-xla/git/commits{/sha}","comments_url":"https://api.github.com/repos/varunjain99/onnx-xla/comments{/number}","issue_comment_url":"https://api.github.com/repos/varunjain99/onnx-xla/issues/comments{/number}","contents_url":"https://api.github.com/repos/varunjain99/onnx-xla/contents/{+path}","compare_url":"https://api.github.com/repos/varunjain99/onnx-xla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/varunjain99/onnx-xla/merges","archive_url":"https://api.github.com/repos/varunjain99/onnx-xla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/varunjain99/onnx-xla/downloads","issues_url":"https://api.github.com/repos/varunjain99/onnx-xla/issues{/number}","pulls_url":"https://api.github.com/repos/varunjain99/onnx-xla/pulls{/number}","milestones_url":"https://api.github.com/repos/varunjain99/onnx-xla/milestones{/number}","notifications_url":"https://api.github.com/repos/varunjain99/onnx-xla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/varunjain99/onnx-xla/labels{/name}","releases_url":"https://api.github.com/repos/varunjain99/onnx-xla/releases{/id}","deployments_url":"https://api.github.com/repos/varunjain99/onnx-xla/deployments","created_at":"2018-06-14T15:04:31Z","updated_at":"2018-07-18T18:03:15Z","pushed_at":"2018-07-19T17:57:54Z","git_url":"git://github.com/varunjain99/onnx-xla.git","ssh_url":"git@github.com:varunjain99/onnx-xla.git","clone_url":"https://github.com/varunjain99/onnx-xla.git","svn_url":"https://github.com/varunjain99/onnx-xla","homepage":null,"size":133375,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":1,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/16"},"html":{"href":"https://github.com/varunjain99/onnx-xla/pull/16"},"issue":{"href":"https://api.github.com/repos/varunjain99/onnx-xla/issues/16"},"comments":{"href":"https://api.github.com/repos/varunjain99/onnx-xla/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/varunjain99/onnx-xla/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/varunjain99/onnx-xla/statuses/d4746db7ee20d7e1d54c86a0eaade88a2055e613"}},"author_association":"OWNER"}}
{"actor":{"display_login":"varunjain99"}}