{"action":"created","comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments/85976421","pull_request_review_id":6657857,"id":85976421,"diff_hunk":"@@ -829,3 +829,45 @@ def _hessian_vector_product(ys, xs, v):\n \n   # Second backprop\n   return gradients(elemwise_products, xs)\n+\n+\n+def hessian(ys, x, name=\"hessian\", colocate_gradients_with_ops=False, \n+            gate_gradients=False, aggregation_method=None):\n+  \"\"\"Constructs the Hessian of sum of `ys` with respect to `x`.\n+\n+  `hessian()` adds ops to the graph to output the Hessian of `ys` with \n+  respect to `x` and returns a `Tensor`.\n+\n+  Args:\n+    ys: A `Tensor` or list of tensors to be differentiated.\n+    x: A `Tensor` to be used for differentiation.\n+    name: Optional name to use for grouping all the gradient ops together.\n+      defaults to 'gradients'.\n+    colocate_gradients_with_ops: If True, try colocating gradients with\n+      the corresponding op.\n+    gate_gradients: If True, add a tuple around the gradients returned\n+      for an operation.  This avoids some race conditions.\n+    aggregation_method: Specifies the method used to combine gradient terms.\n+      Accepted values are constants defined in the class `AggregationMethod`.\n+\n+  Returns:\n+    The hessian of `sum(ys)` with respect to `x`.\n+\n+  Raises:\n+    LookupError: if one of the operations between `x` and `ys` does not\n+      have a registered gradient function.\n+    ValueError: if the arguments are invalid\n+  \"\"\"\n+  ndims = x.get_shape().ndims\n+  if ndims is not None and ndims != 1:","path":"tensorflow/python/ops/gradients.py","position":43,"original_position":43,"commit_id":"9c2c83f39b50b6e8d82dad07d41f2999ed11ee20","original_commit_id":"9c2c83f39b50b6e8d82dad07d41f2999ed11ee20","user":{"login":"vrv","id":463737,"avatar_url":"https://avatars.githubusercontent.com/u/463737?v=3","gravatar_id":"","url":"https://api.github.com/users/vrv","html_url":"https://github.com/vrv","followers_url":"https://api.github.com/users/vrv/followers","following_url":"https://api.github.com/users/vrv/following{/other_user}","gists_url":"https://api.github.com/users/vrv/gists{/gist_id}","starred_url":"https://api.github.com/users/vrv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vrv/subscriptions","organizations_url":"https://api.github.com/users/vrv/orgs","repos_url":"https://api.github.com/users/vrv/repos","events_url":"https://api.github.com/users/vrv/events{/privacy}","received_events_url":"https://api.github.com/users/vrv/received_events","type":"User","site_admin":false},"body":"This will do the wrong thing if 'x''s shape is not known.  I think you want to do:\r\n\r\nif ndims is None or ndims != 1\r\n\r\nSo that it fails when we can't tell it's a vector or not.\r\n\r\nWe should also add a test for these error conditions.","created_at":"2016-11-01T17:18:18Z","updated_at":"2016-11-01T17:18:18Z","html_url":"https://github.com/tensorflow/tensorflow/pull/5329#discussion_r85976421","pull_request_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/5329","_links":{"self":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments/85976421"},"html":{"href":"https://github.com/tensorflow/tensorflow/pull/5329#discussion_r85976421"},"pull_request":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/5329"}}},"pull_request":{"url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/5329","id":91809647,"html_url":"https://github.com/tensorflow/tensorflow/pull/5329","diff_url":"https://github.com/tensorflow/tensorflow/pull/5329.diff","patch_url":"https://github.com/tensorflow/tensorflow/pull/5329.patch","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/5329","number":5329,"state":"open","locked":false,"title":"Hessian with respect to one-dimensional tensors","user":{"login":"tillahoffmann","id":966348,"avatar_url":"https://avatars.githubusercontent.com/u/966348?v=3","gravatar_id":"","url":"https://api.github.com/users/tillahoffmann","html_url":"https://github.com/tillahoffmann","followers_url":"https://api.github.com/users/tillahoffmann/followers","following_url":"https://api.github.com/users/tillahoffmann/following{/other_user}","gists_url":"https://api.github.com/users/tillahoffmann/gists{/gist_id}","starred_url":"https://api.github.com/users/tillahoffmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillahoffmann/subscriptions","organizations_url":"https://api.github.com/users/tillahoffmann/orgs","repos_url":"https://api.github.com/users/tillahoffmann/repos","events_url":"https://api.github.com/users/tillahoffmann/events{/privacy}","received_events_url":"https://api.github.com/users/tillahoffmann/received_events","type":"User","site_admin":false},"body":"This PR adds an operation to compute the Hessian with respect to one-dimensional tensors.","created_at":"2016-11-01T15:56:15Z","updated_at":"2016-11-01T17:29:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e7c74c9e7672ed688687416248a50b95fcf5f3fc","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/5329/commits","review_comments_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/5329/comments","review_comment_url":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/5329/comments","statuses_url":"https://api.github.com/repos/tensorflow/tensorflow/statuses/9c2c83f39b50b6e8d82dad07d41f2999ed11ee20","head":{"label":"tillahoffmann:hessian","ref":"hessian","sha":"9c2c83f39b50b6e8d82dad07d41f2999ed11ee20","user":{"login":"tillahoffmann","id":966348,"avatar_url":"https://avatars.githubusercontent.com/u/966348?v=3","gravatar_id":"","url":"https://api.github.com/users/tillahoffmann","html_url":"https://github.com/tillahoffmann","followers_url":"https://api.github.com/users/tillahoffmann/followers","following_url":"https://api.github.com/users/tillahoffmann/following{/other_user}","gists_url":"https://api.github.com/users/tillahoffmann/gists{/gist_id}","starred_url":"https://api.github.com/users/tillahoffmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillahoffmann/subscriptions","organizations_url":"https://api.github.com/users/tillahoffmann/orgs","repos_url":"https://api.github.com/users/tillahoffmann/repos","events_url":"https://api.github.com/users/tillahoffmann/events{/privacy}","received_events_url":"https://api.github.com/users/tillahoffmann/received_events","type":"User","site_admin":false},"repo":{"id":55236016,"name":"tensorflow","full_name":"tillahoffmann/tensorflow","owner":{"login":"tillahoffmann","id":966348,"avatar_url":"https://avatars.githubusercontent.com/u/966348?v=3","gravatar_id":"","url":"https://api.github.com/users/tillahoffmann","html_url":"https://github.com/tillahoffmann","followers_url":"https://api.github.com/users/tillahoffmann/followers","following_url":"https://api.github.com/users/tillahoffmann/following{/other_user}","gists_url":"https://api.github.com/users/tillahoffmann/gists{/gist_id}","starred_url":"https://api.github.com/users/tillahoffmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillahoffmann/subscriptions","organizations_url":"https://api.github.com/users/tillahoffmann/orgs","repos_url":"https://api.github.com/users/tillahoffmann/repos","events_url":"https://api.github.com/users/tillahoffmann/events{/privacy}","received_events_url":"https://api.github.com/users/tillahoffmann/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tillahoffmann/tensorflow","description":"Computation using data flow graphs for scalable machine learning","fork":true,"url":"https://api.github.com/repos/tillahoffmann/tensorflow","forks_url":"https://api.github.com/repos/tillahoffmann/tensorflow/forks","keys_url":"https://api.github.com/repos/tillahoffmann/tensorflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tillahoffmann/tensorflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tillahoffmann/tensorflow/teams","hooks_url":"https://api.github.com/repos/tillahoffmann/tensorflow/hooks","issue_events_url":"https://api.github.com/repos/tillahoffmann/tensorflow/issues/events{/number}","events_url":"https://api.github.com/repos/tillahoffmann/tensorflow/events","assignees_url":"https://api.github.com/repos/tillahoffmann/tensorflow/assignees{/user}","branches_url":"https://api.github.com/repos/tillahoffmann/tensorflow/branches{/branch}","tags_url":"https://api.github.com/repos/tillahoffmann/tensorflow/tags","blobs_url":"https://api.github.com/repos/tillahoffmann/tensorflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tillahoffmann/tensorflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tillahoffmann/tensorflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/tillahoffmann/tensorflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tillahoffmann/tensorflow/statuses/{sha}","languages_url":"https://api.github.com/repos/tillahoffmann/tensorflow/languages","stargazers_url":"https://api.github.com/repos/tillahoffmann/tensorflow/stargazers","contributors_url":"https://api.github.com/repos/tillahoffmann/tensorflow/contributors","subscribers_url":"https://api.github.com/repos/tillahoffmann/tensorflow/subscribers","subscription_url":"https://api.github.com/repos/tillahoffmann/tensorflow/subscription","commits_url":"https://api.github.com/repos/tillahoffmann/tensorflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/tillahoffmann/tensorflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/tillahoffmann/tensorflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/tillahoffmann/tensorflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/tillahoffmann/tensorflow/contents/{+path}","compare_url":"https://api.github.com/repos/tillahoffmann/tensorflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tillahoffmann/tensorflow/merges","archive_url":"https://api.github.com/repos/tillahoffmann/tensorflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tillahoffmann/tensorflow/downloads","issues_url":"https://api.github.com/repos/tillahoffmann/tensorflow/issues{/number}","pulls_url":"https://api.github.com/repos/tillahoffmann/tensorflow/pulls{/number}","milestones_url":"https://api.github.com/repos/tillahoffmann/tensorflow/milestones{/number}","notifications_url":"https://api.github.com/repos/tillahoffmann/tensorflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tillahoffmann/tensorflow/labels{/name}","releases_url":"https://api.github.com/repos/tillahoffmann/tensorflow/releases{/id}","deployments_url":"https://api.github.com/repos/tillahoffmann/tensorflow/deployments","created_at":"2016-04-01T13:53:22Z","updated_at":"2016-04-01T13:53:28Z","pushed_at":"2016-11-01T15:55:30Z","git_url":"git://github.com/tillahoffmann/tensorflow.git","ssh_url":"git@github.com:tillahoffmann/tensorflow.git","clone_url":"https://github.com/tillahoffmann/tensorflow.git","svn_url":"https://github.com/tillahoffmann/tensorflow","homepage":"http://tensorflow.org","size":67427,"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":"d9a89a5cf63b2ecedf68d3eefdc24be3f519e503","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-11-01T17:23:01Z","pushed_at":"2016-11-01T16:16:01Z","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":386986,"stargazers_count":35890,"watchers_count":35890,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":16053,"mirror_url":null,"open_issues_count":598,"forks":16053,"open_issues":598,"watchers":35890,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/5329"},"html":{"href":"https://github.com/tensorflow/tensorflow/pull/5329"},"issue":{"href":"https://api.github.com/repos/tensorflow/tensorflow/issues/5329"},"comments":{"href":"https://api.github.com/repos/tensorflow/tensorflow/issues/5329/comments"},"review_comments":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/5329/comments"},"review_comment":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tensorflow/tensorflow/pulls/5329/commits"},"statuses":{"href":"https://api.github.com/repos/tensorflow/tensorflow/statuses/9c2c83f39b50b6e8d82dad07d41f2999ed11ee20"}}}}
{"actor":{"display_login":"vrv"}}