{"action":"created","comment":{"url":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/comments/225033966","pull_request_review_id":164544803,"id":225033966,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTAzMzk2Ng==","diff_hunk":"@@ -0,0 +1,56 @@\n+import copy\n+import numpy as np\n+import tensorflow as tf\n+\n+from onnx_tf.handlers.backend_handler import BackendHandler\n+from onnx_tf.handlers.handler import onnx_op\n+from onnx_tf.handlers.handler import tf_func\n+\n+\n+@onnx_op(\"EyeLike\")\n+@tf_func(tf.eye)\n+class EyeLike(BackendHandler):\n+\n+  @classmethod\n+  def version_9(cls, node, **kwargs):\n+\n+    attrs = copy.deepcopy(node.attrs)\n+    inp = kwargs[\"tensor_dict\"][node.inputs[0]]\n+    dtype = attrs[\"dtype\"] if \"dtype\" in attrs else inp.dtype\n+    offset = attrs[\"k\"] if \"k\" in attrs else 0\n+    shape = inp.shape.as_list()\n+    # remove all attrs\n+    attrs.pop(\"dtype\", None)\n+    attrs.pop(\"k\", None)\n+\n+    if offset == 0:\n+      shape = tf.constant(shape, dtype=tf.int32)\n+      attrs[\"num_rows\"] = shape[0]\n+      attrs[\"num_columns\"] = shape[1]\n+      attrs[\"dtype\"] = dtype\n+      return [\n+          cls.make_tensor_from_onnx_node(\n+              node, inputs=[], attrs=attrs, **kwargs)\n+      ]\n+\n+    else:\n+      max_eye_shape_1 = shape[1] if offset > 0 else shape[0]\n+      max_eye_shape_2 = shape[0] if offset > 0 else shape[1]\n+      if abs(offset) > max_eye_shape_1:\n+        offset = max_eye_shape_1 * np.sign(offset)\n+      abs_offset = abs(offset)\n+      eye_shape = min(max_eye_shape_1 - abs_offset, max_eye_shape_2)\n+      tensor = tf.eye(eye_shape, num_columns=eye_shape, dtype=dtype)\n+      if offset > 0:\n+        tb_paddings = [0, shape[0] - eye_shape]\n+        lr_paddings = [offset, shape[1] - offset - eye_shape]\n+      else:\n+        tb_paddings = [abs_offset, shape[0] - abs_offset - eye_shape]\n+        lr_paddings = [0, shape[1] - eye_shape]\n+      paddings = tf.constant([tb_paddings, lr_paddings], dtype=tf.int32)\n+      attrs[\"paddings\"] = paddings\n+      attrs[\"constant_values\"] = tf.cast(0, dtype)","path":"onnx_tf/handlers/backend/eye_like.py","position":52,"original_position":52,"commit_id":"18b82270290080496a866e2b546220174f8c6d0b","original_commit_id":"18b82270290080496a866e2b546220174f8c6d0b","user":{"login":"tjingrant","id":6410074,"node_id":"MDQ6VXNlcjY0MTAwNzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6410074?v=4","gravatar_id":"","url":"https://api.github.com/users/tjingrant","html_url":"https://github.com/tjingrant","followers_url":"https://api.github.com/users/tjingrant/followers","following_url":"https://api.github.com/users/tjingrant/following{/other_user}","gists_url":"https://api.github.com/users/tjingrant/gists{/gist_id}","starred_url":"https://api.github.com/users/tjingrant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tjingrant/subscriptions","organizations_url":"https://api.github.com/users/tjingrant/orgs","repos_url":"https://api.github.com/users/tjingrant/repos","events_url":"https://api.github.com/users/tjingrant/events{/privacy}","received_events_url":"https://api.github.com/users/tjingrant/received_events","type":"User","site_admin":false},"body":"Hi Winnie, this is an attribute, so i don't think you should use tf.cast since it returns a tensor.\r\nRegardless, I think you can simply ignore this field since tf.pad uses 0 as the default value to pad.","created_at":"2018-10-15T04:10:38Z","updated_at":"2018-10-15T04:10:38Z","html_url":"https://github.com/onnx/onnx-tensorflow/pull/279#discussion_r225033966","pull_request_url":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/279","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/comments/225033966"},"html":{"href":"https://github.com/onnx/onnx-tensorflow/pull/279#discussion_r225033966"},"pull_request":{"href":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/279"}}},"pull_request":{"url":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/279","id":222304027,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyMzA0MDI3","html_url":"https://github.com/onnx/onnx-tensorflow/pull/279","diff_url":"https://github.com/onnx/onnx-tensorflow/pull/279.diff","patch_url":"https://github.com/onnx/onnx-tensorflow/pull/279.patch","issue_url":"https://api.github.com/repos/onnx/onnx-tensorflow/issues/279","number":279,"state":"open","locked":false,"title":"Add EyeLike backend support","user":{"login":"winnietsang","id":25941146,"node_id":"MDQ6VXNlcjI1OTQxMTQ2","avatar_url":"https://avatars3.githubusercontent.com/u/25941146?v=4","gravatar_id":"","url":"https://api.github.com/users/winnietsang","html_url":"https://github.com/winnietsang","followers_url":"https://api.github.com/users/winnietsang/followers","following_url":"https://api.github.com/users/winnietsang/following{/other_user}","gists_url":"https://api.github.com/users/winnietsang/gists{/gist_id}","starred_url":"https://api.github.com/users/winnietsang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/winnietsang/subscriptions","organizations_url":"https://api.github.com/users/winnietsang/orgs","repos_url":"https://api.github.com/users/winnietsang/repos","events_url":"https://api.github.com/users/winnietsang/events{/privacy}","received_events_url":"https://api.github.com/users/winnietsang/received_events","type":"User","site_admin":false},"body":"closes: https://github.com/onnx/onnx-tensorflow/issues/269","created_at":"2018-10-11T22:59:17Z","updated_at":"2018-10-15T04:10:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0525cd49e6d71ec8436ad87c41e33417b5670c07","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/279/commits","review_comments_url":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/279/comments","review_comment_url":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/onnx/onnx-tensorflow/issues/279/comments","statuses_url":"https://api.github.com/repos/onnx/onnx-tensorflow/statuses/18b82270290080496a866e2b546220174f8c6d0b","head":{"label":"winnietsang:add-eyelike","ref":"add-eyelike","sha":"18b82270290080496a866e2b546220174f8c6d0b","user":{"login":"winnietsang","id":25941146,"node_id":"MDQ6VXNlcjI1OTQxMTQ2","avatar_url":"https://avatars3.githubusercontent.com/u/25941146?v=4","gravatar_id":"","url":"https://api.github.com/users/winnietsang","html_url":"https://github.com/winnietsang","followers_url":"https://api.github.com/users/winnietsang/followers","following_url":"https://api.github.com/users/winnietsang/following{/other_user}","gists_url":"https://api.github.com/users/winnietsang/gists{/gist_id}","starred_url":"https://api.github.com/users/winnietsang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/winnietsang/subscriptions","organizations_url":"https://api.github.com/users/winnietsang/orgs","repos_url":"https://api.github.com/users/winnietsang/repos","events_url":"https://api.github.com/users/winnietsang/events{/privacy}","received_events_url":"https://api.github.com/users/winnietsang/received_events","type":"User","site_admin":false},"repo":{"id":150489075,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA0ODkwNzU=","name":"onnx-tensorflow","full_name":"winnietsang/onnx-tensorflow","private":false,"owner":{"login":"winnietsang","id":25941146,"node_id":"MDQ6VXNlcjI1OTQxMTQ2","avatar_url":"https://avatars3.githubusercontent.com/u/25941146?v=4","gravatar_id":"","url":"https://api.github.com/users/winnietsang","html_url":"https://github.com/winnietsang","followers_url":"https://api.github.com/users/winnietsang/followers","following_url":"https://api.github.com/users/winnietsang/following{/other_user}","gists_url":"https://api.github.com/users/winnietsang/gists{/gist_id}","starred_url":"https://api.github.com/users/winnietsang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/winnietsang/subscriptions","organizations_url":"https://api.github.com/users/winnietsang/orgs","repos_url":"https://api.github.com/users/winnietsang/repos","events_url":"https://api.github.com/users/winnietsang/events{/privacy}","received_events_url":"https://api.github.com/users/winnietsang/received_events","type":"User","site_admin":false},"html_url":"https://github.com/winnietsang/onnx-tensorflow","description":"Tensorflow Backend and Frontend for ONNX","fork":true,"url":"https://api.github.com/repos/winnietsang/onnx-tensorflow","forks_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/forks","keys_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/teams","hooks_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/hooks","issue_events_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/issues/events{/number}","events_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/events","assignees_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/assignees{/user}","branches_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/branches{/branch}","tags_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/tags","blobs_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/statuses/{sha}","languages_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/languages","stargazers_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/stargazers","contributors_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/contributors","subscribers_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/subscribers","subscription_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/subscription","commits_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/contents/{+path}","compare_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/merges","archive_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/downloads","issues_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/issues{/number}","pulls_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/pulls{/number}","milestones_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/milestones{/number}","notifications_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/labels{/name}","releases_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/releases{/id}","deployments_url":"https://api.github.com/repos/winnietsang/onnx-tensorflow/deployments","created_at":"2018-09-26T20:55:18Z","updated_at":"2018-10-12T00:11:57Z","pushed_at":"2018-10-13T18:54:38Z","git_url":"git://github.com/winnietsang/onnx-tensorflow.git","ssh_url":"git@github.com:winnietsang/onnx-tensorflow.git","clone_url":"https://github.com/winnietsang/onnx-tensorflow.git","svn_url":"https://github.com/winnietsang/onnx-tensorflow","homepage":"","size":533,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"onnx:master","ref":"master","sha":"171c6721e7812d364c4490998c67ec41d2974cc1","user":{"login":"onnx","id":31675368,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNjc1MzY4","avatar_url":"https://avatars3.githubusercontent.com/u/31675368?v=4","gravatar_id":"","url":"https://api.github.com/users/onnx","html_url":"https://github.com/onnx","followers_url":"https://api.github.com/users/onnx/followers","following_url":"https://api.github.com/users/onnx/following{/other_user}","gists_url":"https://api.github.com/users/onnx/gists{/gist_id}","starred_url":"https://api.github.com/users/onnx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onnx/subscriptions","organizations_url":"https://api.github.com/users/onnx/orgs","repos_url":"https://api.github.com/users/onnx/repos","events_url":"https://api.github.com/users/onnx/events{/privacy}","received_events_url":"https://api.github.com/users/onnx/received_events","type":"Organization","site_admin":false},"repo":{"id":105942505,"node_id":"MDEwOlJlcG9zaXRvcnkxMDU5NDI1MDU=","name":"onnx-tensorflow","full_name":"onnx/onnx-tensorflow","private":false,"owner":{"login":"onnx","id":31675368,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNjc1MzY4","avatar_url":"https://avatars3.githubusercontent.com/u/31675368?v=4","gravatar_id":"","url":"https://api.github.com/users/onnx","html_url":"https://github.com/onnx","followers_url":"https://api.github.com/users/onnx/followers","following_url":"https://api.github.com/users/onnx/following{/other_user}","gists_url":"https://api.github.com/users/onnx/gists{/gist_id}","starred_url":"https://api.github.com/users/onnx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onnx/subscriptions","organizations_url":"https://api.github.com/users/onnx/orgs","repos_url":"https://api.github.com/users/onnx/repos","events_url":"https://api.github.com/users/onnx/events{/privacy}","received_events_url":"https://api.github.com/users/onnx/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/onnx/onnx-tensorflow","description":"Tensorflow Backend and Frontend for ONNX","fork":false,"url":"https://api.github.com/repos/onnx/onnx-tensorflow","forks_url":"https://api.github.com/repos/onnx/onnx-tensorflow/forks","keys_url":"https://api.github.com/repos/onnx/onnx-tensorflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onnx/onnx-tensorflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onnx/onnx-tensorflow/teams","hooks_url":"https://api.github.com/repos/onnx/onnx-tensorflow/hooks","issue_events_url":"https://api.github.com/repos/onnx/onnx-tensorflow/issues/events{/number}","events_url":"https://api.github.com/repos/onnx/onnx-tensorflow/events","assignees_url":"https://api.github.com/repos/onnx/onnx-tensorflow/assignees{/user}","branches_url":"https://api.github.com/repos/onnx/onnx-tensorflow/branches{/branch}","tags_url":"https://api.github.com/repos/onnx/onnx-tensorflow/tags","blobs_url":"https://api.github.com/repos/onnx/onnx-tensorflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onnx/onnx-tensorflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onnx/onnx-tensorflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/onnx/onnx-tensorflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onnx/onnx-tensorflow/statuses/{sha}","languages_url":"https://api.github.com/repos/onnx/onnx-tensorflow/languages","stargazers_url":"https://api.github.com/repos/onnx/onnx-tensorflow/stargazers","contributors_url":"https://api.github.com/repos/onnx/onnx-tensorflow/contributors","subscribers_url":"https://api.github.com/repos/onnx/onnx-tensorflow/subscribers","subscription_url":"https://api.github.com/repos/onnx/onnx-tensorflow/subscription","commits_url":"https://api.github.com/repos/onnx/onnx-tensorflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/onnx/onnx-tensorflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/onnx/onnx-tensorflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/onnx/onnx-tensorflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/onnx/onnx-tensorflow/contents/{+path}","compare_url":"https://api.github.com/repos/onnx/onnx-tensorflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onnx/onnx-tensorflow/merges","archive_url":"https://api.github.com/repos/onnx/onnx-tensorflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onnx/onnx-tensorflow/downloads","issues_url":"https://api.github.com/repos/onnx/onnx-tensorflow/issues{/number}","pulls_url":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls{/number}","milestones_url":"https://api.github.com/repos/onnx/onnx-tensorflow/milestones{/number}","notifications_url":"https://api.github.com/repos/onnx/onnx-tensorflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onnx/onnx-tensorflow/labels{/name}","releases_url":"https://api.github.com/repos/onnx/onnx-tensorflow/releases{/id}","deployments_url":"https://api.github.com/repos/onnx/onnx-tensorflow/deployments","created_at":"2017-10-05T21:30:34Z","updated_at":"2018-10-12T06:34:10Z","pushed_at":"2018-10-15T03:29:38Z","git_url":"git://github.com/onnx/onnx-tensorflow.git","ssh_url":"git@github.com:onnx/onnx-tensorflow.git","clone_url":"https://github.com/onnx/onnx-tensorflow.git","svn_url":"https://github.com/onnx/onnx-tensorflow","homepage":"","size":556,"stargazers_count":241,"watchers_count":241,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"archived":false,"open_issues_count":39,"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":49,"open_issues":39,"watchers":241,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/279"},"html":{"href":"https://github.com/onnx/onnx-tensorflow/pull/279"},"issue":{"href":"https://api.github.com/repos/onnx/onnx-tensorflow/issues/279"},"comments":{"href":"https://api.github.com/repos/onnx/onnx-tensorflow/issues/279/comments"},"review_comments":{"href":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/279/comments"},"review_comment":{"href":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/onnx/onnx-tensorflow/pulls/279/commits"},"statuses":{"href":"https://api.github.com/repos/onnx/onnx-tensorflow/statuses/18b82270290080496a866e2b546220174f8c6d0b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"tjingrant"}}