{"action":"created","comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments/62739194","id":62739194,"diff_hunk":"@@ -1917,7 +1917,6 @@ def one_hot(indices, depth, on_value=1, off_value=0,\n             axis, dtype], name, \"one_hot\") as name:\n     on_value = ops.convert_to_tensor(on_value, dtype=dtype, name=\"on_value\")","path":"tensorflow/python/ops/array_ops.py","position":2,"original_position":2,"commit_id":"d5973cced2fb296b81dd65226211d4c109575841","original_commit_id":"d5973cced2fb296b81dd65226211d4c109575841","user":{"login":"samjabrahams","id":11607205,"avatar_url":"https://avatars.githubusercontent.com/u/11607205?v=3","gravatar_id":"","url":"https://api.github.com/users/samjabrahams","html_url":"https://github.com/samjabrahams","followers_url":"https://api.github.com/users/samjabrahams/followers","following_url":"https://api.github.com/users/samjabrahams/following{/other_user}","gists_url":"https://api.github.com/users/samjabrahams/gists{/gist_id}","starred_url":"https://api.github.com/users/samjabrahams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samjabrahams/subscriptions","organizations_url":"https://api.github.com/users/samjabrahams/orgs","repos_url":"https://api.github.com/users/samjabrahams/repos","events_url":"https://api.github.com/users/samjabrahams/events{/privacy}","received_events_url":"https://api.github.com/users/samjabrahams/received_events","type":"User","site_admin":false},"body":"@ebrevdo When these are switched to `cast`, we end up with an `UnimplementedError` when trying to cast standard Python numbers to `complex64`, while `convert_to_tensor` has code coverage for this. Might we stick with `convert_to_tensor` for now and switch after the appropriate `cast` implementations are covered? From what I understand, the main downside of `convert_to_tensor` is that it may not work properly when `on_value` and `off_value` are passed in as Tensor objects, but I imagine most people just passing in normal Python types.","created_at":"2016-05-10T19:47:07Z","updated_at":"2016-05-10T19:47:07Z","html_url":"https://github.com/tensorflow/tensorflow/pull/2187#discussion_r62739194","pull_request_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/2187","_links":{"self":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments/62739194"},"html":{"href":"https://github.com/tensorflow/tensorflow/pull/2187#discussion_r62739194"},"pull_request":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/2187"}}},"pull_request":{"url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/2187","id":68505000,"html_url":"https://github.com/tensorflow/tensorflow/pull/2187","diff_url":"https://github.com/tensorflow/tensorflow/pull/2187.diff","patch_url":"https://github.com/tensorflow/tensorflow/pull/2187.patch","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/2187","number":2187,"state":"open","locked":false,"title":"Fix convert_to_tensor error in tf.one_hot","user":{"login":"samjabrahams","id":11607205,"avatar_url":"https://avatars.githubusercontent.com/u/11607205?v=3","gravatar_id":"","url":"https://api.github.com/users/samjabrahams","html_url":"https://github.com/samjabrahams","followers_url":"https://api.github.com/users/samjabrahams/followers","following_url":"https://api.github.com/users/samjabrahams/following{/other_user}","gists_url":"https://api.github.com/users/samjabrahams/gists{/gist_id}","starred_url":"https://api.github.com/users/samjabrahams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samjabrahams/subscriptions","organizations_url":"https://api.github.com/users/samjabrahams/orgs","repos_url":"https://api.github.com/users/samjabrahams/repos","events_url":"https://api.github.com/users/samjabrahams/events{/privacy}","received_events_url":"https://api.github.com/users/samjabrahams/received_events","type":"User","site_admin":false},"body":"Addresses more issues found in #1799. When a user passes in a TensorFlow constant that is not of type `tf.int64` for `indices` or type `tf.int32` for `depth`, `one_hot()` throws a \"Tensor conversion requested...\" error due to using `convert_to_tensor` for those parameters. This PR addresses this by using `tf.cast()` instead for `indices` and `depth`.\r\n\r\nAdditionally, this PR adds more test coverage (has tests using `tf.constant`) and renames some tests introduced in #1869 to be more descriptive.","created_at":"2016-05-01T19:38:53Z","updated_at":"2016-05-10T19:47:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0dcbf630ee8057518e5ce7786cbf97af600243f0","assignee":{"login":"ebrevdo","id":1794715,"avatar_url":"https://avatars.githubusercontent.com/u/1794715?v=3","gravatar_id":"","url":"https://api.github.com/users/ebrevdo","html_url":"https://github.com/ebrevdo","followers_url":"https://api.github.com/users/ebrevdo/followers","following_url":"https://api.github.com/users/ebrevdo/following{/other_user}","gists_url":"https://api.github.com/users/ebrevdo/gists{/gist_id}","starred_url":"https://api.github.com/users/ebrevdo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebrevdo/subscriptions","organizations_url":"https://api.github.com/users/ebrevdo/orgs","repos_url":"https://api.github.com/users/ebrevdo/repos","events_url":"https://api.github.com/users/ebrevdo/events{/privacy}","received_events_url":"https://api.github.com/users/ebrevdo/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/2187/commits","review_comments_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/2187/comments","review_comment_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/2187/comments","statuses_url":"https://api.github.com/repos/tensorflow/tensorflow/statuses/d5973cced2fb296b81dd65226211d4c109575841","head":{"label":"samjabrahams:onehottypes","ref":"onehottypes","sha":"d5973cced2fb296b81dd65226211d4c109575841","user":{"login":"samjabrahams","id":11607205,"avatar_url":"https://avatars.githubusercontent.com/u/11607205?v=3","gravatar_id":"","url":"https://api.github.com/users/samjabrahams","html_url":"https://github.com/samjabrahams","followers_url":"https://api.github.com/users/samjabrahams/followers","following_url":"https://api.github.com/users/samjabrahams/following{/other_user}","gists_url":"https://api.github.com/users/samjabrahams/gists{/gist_id}","starred_url":"https://api.github.com/users/samjabrahams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samjabrahams/subscriptions","organizations_url":"https://api.github.com/users/samjabrahams/orgs","repos_url":"https://api.github.com/users/samjabrahams/repos","events_url":"https://api.github.com/users/samjabrahams/events{/privacy}","received_events_url":"https://api.github.com/users/samjabrahams/received_events","type":"User","site_admin":false},"repo":{"id":47953357,"name":"tensorflow","full_name":"samjabrahams/tensorflow","owner":{"login":"samjabrahams","id":11607205,"avatar_url":"https://avatars.githubusercontent.com/u/11607205?v=3","gravatar_id":"","url":"https://api.github.com/users/samjabrahams","html_url":"https://github.com/samjabrahams","followers_url":"https://api.github.com/users/samjabrahams/followers","following_url":"https://api.github.com/users/samjabrahams/following{/other_user}","gists_url":"https://api.github.com/users/samjabrahams/gists{/gist_id}","starred_url":"https://api.github.com/users/samjabrahams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samjabrahams/subscriptions","organizations_url":"https://api.github.com/users/samjabrahams/orgs","repos_url":"https://api.github.com/users/samjabrahams/repos","events_url":"https://api.github.com/users/samjabrahams/events{/privacy}","received_events_url":"https://api.github.com/users/samjabrahams/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/samjabrahams/tensorflow","description":" Open source software library for numerical computation using data flow graphs.","fork":true,"url":"https://api.github.com/repos/samjabrahams/tensorflow","forks_url":"https://api.github.com/repos/samjabrahams/tensorflow/forks","keys_url":"https://api.github.com/repos/samjabrahams/tensorflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/samjabrahams/tensorflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/samjabrahams/tensorflow/teams","hooks_url":"https://api.github.com/repos/samjabrahams/tensorflow/hooks","issue_events_url":"https://api.github.com/repos/samjabrahams/tensorflow/issues/events{/number}","events_url":"https://api.github.com/repos/samjabrahams/tensorflow/events","assignees_url":"https://api.github.com/repos/samjabrahams/tensorflow/assignees{/user}","branches_url":"https://api.github.com/repos/samjabrahams/tensorflow/branches{/branch}","tags_url":"https://api.github.com/repos/samjabrahams/tensorflow/tags","blobs_url":"https://api.github.com/repos/samjabrahams/tensorflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/samjabrahams/tensorflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/samjabrahams/tensorflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/samjabrahams/tensorflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/samjabrahams/tensorflow/statuses/{sha}","languages_url":"https://api.github.com/repos/samjabrahams/tensorflow/languages","stargazers_url":"https://api.github.com/repos/samjabrahams/tensorflow/stargazers","contributors_url":"https://api.github.com/repos/samjabrahams/tensorflow/contributors","subscribers_url":"https://api.github.com/repos/samjabrahams/tensorflow/subscribers","subscription_url":"https://api.github.com/repos/samjabrahams/tensorflow/subscription","commits_url":"https://api.github.com/repos/samjabrahams/tensorflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/samjabrahams/tensorflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/samjabrahams/tensorflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/samjabrahams/tensorflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/samjabrahams/tensorflow/contents/{+path}","compare_url":"https://api.github.com/repos/samjabrahams/tensorflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/samjabrahams/tensorflow/merges","archive_url":"https://api.github.com/repos/samjabrahams/tensorflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/samjabrahams/tensorflow/downloads","issues_url":"https://api.github.com/repos/samjabrahams/tensorflow/issues{/number}","pulls_url":"https://api.github.com/repos/samjabrahams/tensorflow/pulls{/number}","milestones_url":"https://api.github.com/repos/samjabrahams/tensorflow/milestones{/number}","notifications_url":"https://api.github.com/repos/samjabrahams/tensorflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/samjabrahams/tensorflow/labels{/name}","releases_url":"https://api.github.com/repos/samjabrahams/tensorflow/releases{/id}","deployments_url":"https://api.github.com/repos/samjabrahams/tensorflow/deployments","created_at":"2015-12-14T05:11:39Z","updated_at":"2016-01-23T22:39:56Z","pushed_at":"2016-05-09T08:32:56Z","git_url":"git://github.com/samjabrahams/tensorflow.git","ssh_url":"git@github.com:samjabrahams/tensorflow.git","clone_url":"https://github.com/samjabrahams/tensorflow.git","svn_url":"https://github.com/samjabrahams/tensorflow","homepage":"http://tensorflow.org","size":37276,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tensorflow:master","ref":"master","sha":"4a4f2461533847dde239851ecebe5056088a828c","user":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars.githubusercontent.com/u/15658638?v=3","gravatar_id":"","url":"https://api.github.com/users/tensorflow","html_url":"https://github.com/tensorflow","followers_url":"https://api.github.com/users/tensorflow/followers","following_url":"https://api.github.com/users/tensorflow/following{/other_user}","gists_url":"https://api.github.com/users/tensorflow/gists{/gist_id}","starred_url":"https://api.github.com/users/tensorflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tensorflow/subscriptions","organizations_url":"https://api.github.com/users/tensorflow/orgs","repos_url":"https://api.github.com/users/tensorflow/repos","events_url":"https://api.github.com/users/tensorflow/events{/privacy}","received_events_url":"https://api.github.com/users/tensorflow/received_events","type":"Organization","site_admin":false},"repo":{"id":45717250,"name":"tensorflow","full_name":"tensorflow/tensorflow","owner":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars.githubusercontent.com/u/15658638?v=3","gravatar_id":"","url":"https://api.github.com/users/tensorflow","html_url":"https://github.com/tensorflow","followers_url":"https://api.github.com/users/tensorflow/followers","following_url":"https://api.github.com/users/tensorflow/following{/other_user}","gists_url":"https://api.github.com/users/tensorflow/gists{/gist_id}","starred_url":"https://api.github.com/users/tensorflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tensorflow/subscriptions","organizations_url":"https://api.github.com/users/tensorflow/orgs","repos_url":"https://api.github.com/users/tensorflow/repos","events_url":"https://api.github.com/users/tensorflow/events{/privacy}","received_events_url":"https://api.github.com/users/tensorflow/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tensorflow/tensorflow","description":"Computation using data flow graphs for scalable machine learning","fork":false,"url":"https://api.github.com/repos/tensorflow/tensorflow","forks_url":"https://api.github.com/repos/tensorflow/tensorflow/forks","keys_url":"https://api.github.com/repos/tensorflow/tensorflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tensorflow/tensorflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tensorflow/tensorflow/teams","hooks_url":"https://api.github.com/repos/tensorflow/tensorflow/hooks","issue_events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/events{/number}","events_url":"https://api.github.com/repos/tensorflow/tensorflow/events","assignees_url":"https://api.github.com/repos/tensorflow/tensorflow/assignees{/user}","branches_url":"https://api.github.com/repos/tensorflow/tensorflow/branches{/branch}","tags_url":"https://api.github.com/repos/tensorflow/tensorflow/tags","blobs_url":"https://api.github.com/repos/tensorflow/tensorflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tensorflow/tensorflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tensorflow/tensorflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/tensorflow/tensorflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tensorflow/tensorflow/statuses/{sha}","languages_url":"https://api.github.com/repos/tensorflow/tensorflow/languages","stargazers_url":"https://api.github.com/repos/tensorflow/tensorflow/stargazers","contributors_url":"https://api.github.com/repos/tensorflow/tensorflow/contributors","subscribers_url":"https://api.github.com/repos/tensorflow/tensorflow/subscribers","subscription_url":"https://api.github.com/repos/tensorflow/tensorflow/subscription","commits_url":"https://api.github.com/repos/tensorflow/tensorflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/tensorflow/tensorflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/tensorflow/tensorflow/contents/{+path}","compare_url":"https://api.github.com/repos/tensorflow/tensorflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tensorflow/tensorflow/merges","archive_url":"https://api.github.com/repos/tensorflow/tensorflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tensorflow/tensorflow/downloads","issues_url":"https://api.github.com/repos/tensorflow/tensorflow/issues{/number}","pulls_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls{/number}","milestones_url":"https://api.github.com/repos/tensorflow/tensorflow/milestones{/number}","notifications_url":"https://api.github.com/repos/tensorflow/tensorflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/labels{/name}","releases_url":"https://api.github.com/repos/tensorflow/tensorflow/releases{/id}","deployments_url":"https://api.github.com/repos/tensorflow/tensorflow/deployments","created_at":"2015-11-07T01:19:20Z","updated_at":"2016-05-10T19:33:11Z","pushed_at":"2016-05-10T08:54:38Z","git_url":"git://github.com/tensorflow/tensorflow.git","ssh_url":"git@github.com:tensorflow/tensorflow.git","clone_url":"https://github.com/tensorflow/tensorflow.git","svn_url":"https://github.com/tensorflow/tensorflow","homepage":"http://tensorflow.org","size":194587,"stargazers_count":23196,"watchers_count":23196,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8691,"mirror_url":null,"open_issues_count":478,"forks":8691,"open_issues":478,"watchers":23196,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/2187"},"html":{"href":"https://github.com/tensorflow/tensorflow/pull/2187"},"issue":{"href":"https://api.github.com/repos/tensorflow/tensorflow/issues/2187"},"comments":{"href":"https://api.github.com/repos/tensorflow/tensorflow/issues/2187/comments"},"review_comments":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/2187/comments"},"review_comment":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/2187/commits"},"statuses":{"href":"https://api.github.com/repos/tensorflow/tensorflow/statuses/d5973cced2fb296b81dd65226211d4c109575841"}}}}