{"action":"created","comment":{"url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/comments/273757176","pull_request_review_id":224719223,"id":273757176,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI3Mzc1NzE3Ng==","diff_hunk":"@@ -4273,14 +4273,60 @@ static Status TranslateSelectOp(\n   TF_RETURN_IF_ERROR(\n       GetInputNodes(ng_op_map, op, &ng_input1, &ng_input2, &ng_input3));\n \n-  // broadcast to make all tensors same shape, as required by ngraph select op\n-  std::tie(ng_input1, ng_input2) =\n-      ng::builder::numpy_broadcast(std::make_pair(ng_input1, ng_input2));\n+  if (ng_input2->get_shape() != ng_input3->get_shape()) {\n+    return errors::InvalidArgument(\n+        \"Input tensors 2 and 3 should have same shape\");\n+  }\n+\n+  auto ng_input1_shape = ng_input1->get_shape();\n+  auto ng_input2_shape = ng_input2->get_shape();\n+\n+  auto ng_input1_rank = ng_input1->get_shape().size();\n+  auto ng_input2_rank = ng_input2->get_shape().size();\n+\n+  if (!((ng_input1_shape == ng_input2_shape) ||\n+        ((ng_input1_rank == 1) && (ng_input2_rank > ng_input1_rank) &&\n+         (ng_input2_shape[0] == ng_input1_shape[0])))) {\n+    return errors::InvalidArgument(\n+        \"Input tensor may have the same shape as condition. If condition is \"\n+        \"rank 1, input may have higher rank, but its first dimension must \"\n+        \"match the size of condition.\");\n+  }\n+\n+  int length = 0;\n+  shared_ptr<ng::Node> ng_input_new, ng_select;\n+  ng::AxisVector ng_axis_order;\n+\n+  for (size_t i = 0; i < ng_input2_rank; i++) {\n+    if (ng_input1_shape[0] == ng_input2_shape[i]) {\n+      length = ng_input2_rank - i - ng_input1_rank;\n+    }\n+  }\n+\n+  if (length != 0) {\n+    // Condition tensor will be modified to align the condition tensor\n+    // shape with input tensor shape index and fill the rest of the vector with\n+    // 1s\n+    // Eg: condition tensor [7], input tensor [7, 3, 2, 1]","path":"src/ngraph_builder.cc","position":41,"original_position":41,"commit_id":"3c963b52d70c4694a7e27f2d00bfef59e9a9d65e","original_commit_id":"3c963b52d70c4694a7e27f2d00bfef59e9a9d65e","user":{"login":"sayantan-nervana","id":41931958,"node_id":"MDQ6VXNlcjQxOTMxOTU4","avatar_url":"https://avatars3.githubusercontent.com/u/41931958?v=4","gravatar_id":"","url":"https://api.github.com/users/sayantan-nervana","html_url":"https://github.com/sayantan-nervana","followers_url":"https://api.github.com/users/sayantan-nervana/followers","following_url":"https://api.github.com/users/sayantan-nervana/following{/other_user}","gists_url":"https://api.github.com/users/sayantan-nervana/gists{/gist_id}","starred_url":"https://api.github.com/users/sayantan-nervana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sayantan-nervana/subscriptions","organizations_url":"https://api.github.com/users/sayantan-nervana/orgs","repos_url":"https://api.github.com/users/sayantan-nervana/repos","events_url":"https://api.github.com/users/sayantan-nervana/events{/privacy}","received_events_url":"https://api.github.com/users/sayantan-nervana/received_events","type":"User","site_admin":false},"body":"to make the example more generic, maybe we can say `[5, 7, 3, 2, 1]` . (to show that the realignment is not to make the sizes same, just to match up the first matching number)","created_at":"2019-04-10T01:00:54Z","updated_at":"2019-04-10T01:03:23Z","html_url":"https://github.com/NervanaSystems/ngraph-tf/pull/488#discussion_r273757176","pull_request_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/488","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/comments/273757176"},"html":{"href":"https://github.com/NervanaSystems/ngraph-tf/pull/488#discussion_r273757176"},"pull_request":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/488"}}},"pull_request":{"url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/488","id":267933545,"node_id":"MDExOlB1bGxSZXF1ZXN0MjY3OTMzNTQ1","html_url":"https://github.com/NervanaSystems/ngraph-tf/pull/488","diff_url":"https://github.com/NervanaSystems/ngraph-tf/pull/488.diff","patch_url":"https://github.com/NervanaSystems/ngraph-tf/pull/488.patch","issue_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/issues/488","number":488,"state":"open","locked":false,"title":"Sindhu/Update Select Op to accept more complex shapes as inputs","user":{"login":"sindhu-nervana","id":43015792,"node_id":"MDQ6VXNlcjQzMDE1Nzky","avatar_url":"https://avatars3.githubusercontent.com/u/43015792?v=4","gravatar_id":"","url":"https://api.github.com/users/sindhu-nervana","html_url":"https://github.com/sindhu-nervana","followers_url":"https://api.github.com/users/sindhu-nervana/followers","following_url":"https://api.github.com/users/sindhu-nervana/following{/other_user}","gists_url":"https://api.github.com/users/sindhu-nervana/gists{/gist_id}","starred_url":"https://api.github.com/users/sindhu-nervana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindhu-nervana/subscriptions","organizations_url":"https://api.github.com/users/sindhu-nervana/orgs","repos_url":"https://api.github.com/users/sindhu-nervana/repos","events_url":"https://api.github.com/users/sindhu-nervana/events{/privacy}","received_events_url":"https://api.github.com/users/sindhu-nervana/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-04-05T19:07:45Z","updated_at":"2019-04-10T01:03:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8bb55939358bcc561bf1469878f984178711d0d5","assignee":null,"assignees":[],"requested_reviewers":[{"login":"avijit-nervana","id":30507445,"node_id":"MDQ6VXNlcjMwNTA3NDQ1","avatar_url":"https://avatars0.githubusercontent.com/u/30507445?v=4","gravatar_id":"","url":"https://api.github.com/users/avijit-nervana","html_url":"https://github.com/avijit-nervana","followers_url":"https://api.github.com/users/avijit-nervana/followers","following_url":"https://api.github.com/users/avijit-nervana/following{/other_user}","gists_url":"https://api.github.com/users/avijit-nervana/gists{/gist_id}","starred_url":"https://api.github.com/users/avijit-nervana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avijit-nervana/subscriptions","organizations_url":"https://api.github.com/users/avijit-nervana/orgs","repos_url":"https://api.github.com/users/avijit-nervana/repos","events_url":"https://api.github.com/users/avijit-nervana/events{/privacy}","received_events_url":"https://api.github.com/users/avijit-nervana/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/488/commits","review_comments_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/488/comments","review_comment_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/issues/488/comments","statuses_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/statuses/3c963b52d70c4694a7e27f2d00bfef59e9a9d65e","head":{"label":"NervanaSystems:sindhu/selectop-bugfix","ref":"sindhu/selectop-bugfix","sha":"3c963b52d70c4694a7e27f2d00bfef59e9a9d65e","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":133988684,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM5ODg2ODQ=","name":"ngraph-tf","full_name":"NervanaSystems/ngraph-tf","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-tf","description":"Bridge to connect nGraph with TensorFlow","fork":false,"url":"https://api.github.com/repos/NervanaSystems/ngraph-tf","forks_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/forks","keys_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/teams","hooks_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/hooks","issue_events_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/issues/events{/number}","events_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/events","assignees_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/assignees{/user}","branches_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/branches{/branch}","tags_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/tags","blobs_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/git/refs{/sha}","trees_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/statuses/{sha}","languages_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/languages","stargazers_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/stargazers","contributors_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/contributors","subscribers_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/subscribers","subscription_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/subscription","commits_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/commits{/sha}","git_commits_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/git/commits{/sha}","comments_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/comments{/number}","issue_comment_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/issues/comments{/number}","contents_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/contents/{+path}","compare_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/merges","archive_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/downloads","issues_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/issues{/number}","pulls_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls{/number}","milestones_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/milestones{/number}","notifications_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/labels{/name}","releases_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/releases{/id}","deployments_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/deployments","created_at":"2018-05-18T18:08:43Z","updated_at":"2019-04-10T00:36:08Z","pushed_at":"2019-04-10T00:57:33Z","git_url":"git://github.com/NervanaSystems/ngraph-tf.git","ssh_url":"git@github.com:NervanaSystems/ngraph-tf.git","clone_url":"https://github.com/NervanaSystems/ngraph-tf.git","svn_url":"https://github.com/NervanaSystems/ngraph-tf","homepage":"","size":18930,"stargazers_count":51,"watchers_count":51,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":34,"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":15,"open_issues":34,"watchers":51,"default_branch":"master"}},"base":{"label":"NervanaSystems:master","ref":"master","sha":"62cf9d982796d7a3e36ba7c352500ab552b2a6ae","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":133988684,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM5ODg2ODQ=","name":"ngraph-tf","full_name":"NervanaSystems/ngraph-tf","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-tf","description":"Bridge to connect nGraph with TensorFlow","fork":false,"url":"https://api.github.com/repos/NervanaSystems/ngraph-tf","forks_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/forks","keys_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/teams","hooks_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/hooks","issue_events_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/issues/events{/number}","events_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/events","assignees_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/assignees{/user}","branches_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/branches{/branch}","tags_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/tags","blobs_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/git/refs{/sha}","trees_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/statuses/{sha}","languages_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/languages","stargazers_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/stargazers","contributors_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/contributors","subscribers_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/subscribers","subscription_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/subscription","commits_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/commits{/sha}","git_commits_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/git/commits{/sha}","comments_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/comments{/number}","issue_comment_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/issues/comments{/number}","contents_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/contents/{+path}","compare_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/merges","archive_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/downloads","issues_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/issues{/number}","pulls_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls{/number}","milestones_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/milestones{/number}","notifications_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/labels{/name}","releases_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/releases{/id}","deployments_url":"https://api.github.com/repos/NervanaSystems/ngraph-tf/deployments","created_at":"2018-05-18T18:08:43Z","updated_at":"2019-04-10T00:36:08Z","pushed_at":"2019-04-10T00:57:33Z","git_url":"git://github.com/NervanaSystems/ngraph-tf.git","ssh_url":"git@github.com:NervanaSystems/ngraph-tf.git","clone_url":"https://github.com/NervanaSystems/ngraph-tf.git","svn_url":"https://github.com/NervanaSystems/ngraph-tf","homepage":"","size":18930,"stargazers_count":51,"watchers_count":51,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":34,"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":15,"open_issues":34,"watchers":51,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/488"},"html":{"href":"https://github.com/NervanaSystems/ngraph-tf/pull/488"},"issue":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-tf/issues/488"},"comments":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-tf/issues/488/comments"},"review_comments":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/488/comments"},"review_comment":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-tf/pulls/488/commits"},"statuses":{"href":"https://api.github.com/repos/NervanaSystems/ngraph-tf/statuses/3c963b52d70c4694a7e27f2d00bfef59e9a9d65e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sayantan-nervana"}}