{"action":"created","comment":{"url":"https://api.github.com/repos/tensorflow/tensorboard/pulls/comments/138688707","pull_request_review_id":62518300,"id":138688707,"diff_hunk":"@@ -148,23 +148,141 @@ def op(\n     tn = fp[0] - fp\n     fn = tp[0] - tp\n \n-    # Store the number of thresholds within the summary metadata because\n-    # that value is constant for all pr curve summaries with the same tag.\n-    summary_metadata = metadata.create_summary_metadata(\n-        display_name=display_name if display_name is not None else tag,\n-        description=description or '',\n-        num_thresholds=num_thresholds)\n-\n     precision = tp / tf.maximum(_MINIMUM_COUNT, tp + fp)\n     recall = tp / tf.maximum(_MINIMUM_COUNT, tp + fn)\n \n-    # Store values within a tensor. We store them in the order:\n-    # true positives, false positives, true negatives, false\n-    # negatives, precision, and recall.\n-    combined_data = tf.stack([tp, fp, tn, fn, precision, recall])\n+    return _create_tensor_summary(\n+        tag,\n+        tp,\n+        fp,\n+        tn,\n+        fn,\n+        precision,\n+        recall,\n+        num_thresholds,\n+        display_name,\n+        description,\n+        collections)\n+\n+def raw_metrics_op(\n+    tag,\n+    true_positive_counts,\n+    false_positive_counts,\n+    true_negative_counts,\n+    false_negative_counts,\n+    precision,\n+    recall,\n+    num_thresholds=None,\n+    display_name=None,\n+    description=None,\n+    collections=None):\n+  \"\"\"Create an op that collects data for visualizing PR curves.\n+\n+  Unlike the op above, this one avoids computing precision, recall, and the\n+  intermediate counts. Instead, it accepts those tensors as arguments and\n+  relies on the caller to ensure that the calculations are correct (and the\n+  counts yield the provided precision and recall values).\n+\n+  This op is useful when a caller seeks to compute precision and recall\n+  differently but still use the PR curves plugin.\n+\n+  Args:\n+    tag: A tag attached to the summary. Used by TensorBoard for organization.\n+    true_positive_counts: A rank-1 tensor of true positive counts. Must contain\n+        `num_thresholds` elements and be castable to float32.\n+    false_positive_counts: A rank-1 tensor of false positive counts. Must\n+        contain `num_thresholds` elements and be castable to float32.\n+    true_negative_counts: A rank-1 tensor of true negative counts. Must contain\n+        `num_thresholds` elements and be castable to float32.\n+    false_negative_counts: A rank-1 tensor of false negative counts. Must\n+        contain `num_thresholds` elements and be castable to float32.\n+    num_thresholds: Number of thresholds, evenly distributed in `[0, 1]`, to\n+        compute PR metrics for. Should be `>= 2`. This value should be a\n+        constant integer value, not a Tensor that stores an integer.\n+    display_name: Optional name for this summary in TensorBoard, as a\n+        constant `str`. Defaults to `name`.\n+    description: Optional long-form description for this summary, as a\n+        constant `str`. Markdown is supported. Defaults to empty.\n+    collections: Optional list of graph collections keys. The new\n+        summary op is added to these collections. Defaults to\n+        `[Graph Keys.SUMMARIES]`.\n+\n+  Returns:\n+    A summary operation for use in a TensorFlow graph. See docs for the `op`\n+    method for details on the float32 tensor produced by this summary.\n+  \"\"\"\n+  with tf.name_scope(tag, values=[\n+      true_positive_counts,\n+      false_positive_counts,\n+      true_negative_counts,\n+      false_negative_counts,\n+      precision,\n+      recall","path":"tensorboard/plugins/pr_curve/summary.py","position":null,"original_position":84,"commit_id":"0dcd119ba2e6dc38a08aefb7809677804c749a7a","original_commit_id":"b1a40fc64fb0ee0775744cf1221d793e6b6c0553","user":{"login":"chihuahua","id":4221553,"avatar_url":"https://avatars0.githubusercontent.com/u/4221553?v=4","gravatar_id":"","url":"https://api.github.com/users/chihuahua","html_url":"https://github.com/chihuahua","followers_url":"https://api.github.com/users/chihuahua/followers","following_url":"https://api.github.com/users/chihuahua/following{/other_user}","gists_url":"https://api.github.com/users/chihuahua/gists{/gist_id}","starred_url":"https://api.github.com/users/chihuahua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chihuahua/subscriptions","organizations_url":"https://api.github.com/users/chihuahua/orgs","repos_url":"https://api.github.com/users/chihuahua/repos","events_url":"https://api.github.com/users/chihuahua/events{/privacy}","received_events_url":"https://api.github.com/users/chihuahua/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2017-09-13T17:38:47Z","updated_at":"2017-09-13T17:55:04Z","html_url":"https://github.com/tensorflow/tensorboard/pull/520#discussion_r138688707","pull_request_url":"https://api.github.com/repos/tensorflow/tensorboard/pulls/520","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/tensorflow/tensorboard/pulls/comments/138688707"},"html":{"href":"https://github.com/tensorflow/tensorboard/pull/520#discussion_r138688707"},"pull_request":{"href":"https://api.github.com/repos/tensorflow/tensorboard/pulls/520"}},"in_reply_to_id":138651682},"pull_request":{"url":"https://api.github.com/repos/tensorflow/tensorboard/pulls/520","id":140738123,"html_url":"https://github.com/tensorflow/tensorboard/pull/520","diff_url":"https://github.com/tensorflow/tensorboard/pull/520.diff","patch_url":"https://github.com/tensorflow/tensorboard/pull/520.patch","issue_url":"https://api.github.com/repos/tensorflow/tensorboard/issues/520","number":520,"state":"open","locked":false,"title":"Create raw_metrics_op for creating PR curves","user":{"login":"chihuahua","id":4221553,"avatar_url":"https://avatars0.githubusercontent.com/u/4221553?v=4","gravatar_id":"","url":"https://api.github.com/users/chihuahua","html_url":"https://github.com/chihuahua","followers_url":"https://api.github.com/users/chihuahua/followers","following_url":"https://api.github.com/users/chihuahua/following{/other_user}","gists_url":"https://api.github.com/users/chihuahua/gists{/gist_id}","starred_url":"https://api.github.com/users/chihuahua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chihuahua/subscriptions","organizations_url":"https://api.github.com/users/chihuahua/orgs","repos_url":"https://api.github.com/users/chihuahua/repos","events_url":"https://api.github.com/users/chihuahua/events{/privacy}","received_events_url":"https://api.github.com/users/chihuahua/received_events","type":"User","site_admin":false},"body":"This change introduces a `raw_metrics_op` for collecting data for generating PR curves. Fixes #515. See #515 for the motivation behind `raw_metrics_op`. ","created_at":"2017-09-13T05:31:59Z","updated_at":"2017-09-13T17:55:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d09ecdaabc0ec337885507c6a5899a0081d4917","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/tensorflow/tensorboard/pulls/520/commits","review_comments_url":"https://api.github.com/repos/tensorflow/tensorboard/pulls/520/comments","review_comment_url":"https://api.github.com/repos/tensorflow/tensorboard/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tensorflow/tensorboard/issues/520/comments","statuses_url":"https://api.github.com/repos/tensorflow/tensorboard/statuses/0dcd119ba2e6dc38a08aefb7809677804c749a7a","head":{"label":"tensorflow:chihuahua-raw-metrics-op","ref":"chihuahua-raw-metrics-op","sha":"0dcd119ba2e6dc38a08aefb7809677804c749a7a","user":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","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":91379993,"name":"tensorboard","full_name":"tensorflow/tensorboard","owner":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","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/tensorboard","description":"TensorFlow's Visualization Toolkit","fork":false,"url":"https://api.github.com/repos/tensorflow/tensorboard","forks_url":"https://api.github.com/repos/tensorflow/tensorboard/forks","keys_url":"https://api.github.com/repos/tensorflow/tensorboard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tensorflow/tensorboard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tensorflow/tensorboard/teams","hooks_url":"https://api.github.com/repos/tensorflow/tensorboard/hooks","issue_events_url":"https://api.github.com/repos/tensorflow/tensorboard/issues/events{/number}","events_url":"https://api.github.com/repos/tensorflow/tensorboard/events","assignees_url":"https://api.github.com/repos/tensorflow/tensorboard/assignees{/user}","branches_url":"https://api.github.com/repos/tensorflow/tensorboard/branches{/branch}","tags_url":"https://api.github.com/repos/tensorflow/tensorboard/tags","blobs_url":"https://api.github.com/repos/tensorflow/tensorboard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tensorflow/tensorboard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tensorflow/tensorboard/git/refs{/sha}","trees_url":"https://api.github.com/repos/tensorflow/tensorboard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tensorflow/tensorboard/statuses/{sha}","languages_url":"https://api.github.com/repos/tensorflow/tensorboard/languages","stargazers_url":"https://api.github.com/repos/tensorflow/tensorboard/stargazers","contributors_url":"https://api.github.com/repos/tensorflow/tensorboard/contributors","subscribers_url":"https://api.github.com/repos/tensorflow/tensorboard/subscribers","subscription_url":"https://api.github.com/repos/tensorflow/tensorboard/subscription","commits_url":"https://api.github.com/repos/tensorflow/tensorboard/commits{/sha}","git_commits_url":"https://api.github.com/repos/tensorflow/tensorboard/git/commits{/sha}","comments_url":"https://api.github.com/repos/tensorflow/tensorboard/comments{/number}","issue_comment_url":"https://api.github.com/repos/tensorflow/tensorboard/issues/comments{/number}","contents_url":"https://api.github.com/repos/tensorflow/tensorboard/contents/{+path}","compare_url":"https://api.github.com/repos/tensorflow/tensorboard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tensorflow/tensorboard/merges","archive_url":"https://api.github.com/repos/tensorflow/tensorboard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tensorflow/tensorboard/downloads","issues_url":"https://api.github.com/repos/tensorflow/tensorboard/issues{/number}","pulls_url":"https://api.github.com/repos/tensorflow/tensorboard/pulls{/number}","milestones_url":"https://api.github.com/repos/tensorflow/tensorboard/milestones{/number}","notifications_url":"https://api.github.com/repos/tensorflow/tensorboard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tensorflow/tensorboard/labels{/name}","releases_url":"https://api.github.com/repos/tensorflow/tensorboard/releases{/id}","deployments_url":"https://api.github.com/repos/tensorflow/tensorboard/deployments","created_at":"2017-05-15T20:08:07Z","updated_at":"2017-09-13T17:15:28Z","pushed_at":"2017-09-13T17:44:14Z","git_url":"git://github.com/tensorflow/tensorboard.git","ssh_url":"git@github.com:tensorflow/tensorboard.git","clone_url":"https://github.com/tensorflow/tensorboard.git","svn_url":"https://github.com/tensorflow/tensorboard","homepage":null,"size":6407,"stargazers_count":363,"watchers_count":363,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":120,"mirror_url":null,"open_issues_count":135,"forks":120,"open_issues":135,"watchers":363,"default_branch":"master"}},"base":{"label":"tensorflow:master","ref":"master","sha":"d130cff3f26551fd0a9e91a3e05b81b203833c7c","user":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","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":91379993,"name":"tensorboard","full_name":"tensorflow/tensorboard","owner":{"login":"tensorflow","id":15658638,"avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","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/tensorboard","description":"TensorFlow's Visualization Toolkit","fork":false,"url":"https://api.github.com/repos/tensorflow/tensorboard","forks_url":"https://api.github.com/repos/tensorflow/tensorboard/forks","keys_url":"https://api.github.com/repos/tensorflow/tensorboard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tensorflow/tensorboard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tensorflow/tensorboard/teams","hooks_url":"https://api.github.com/repos/tensorflow/tensorboard/hooks","issue_events_url":"https://api.github.com/repos/tensorflow/tensorboard/issues/events{/number}","events_url":"https://api.github.com/repos/tensorflow/tensorboard/events","assignees_url":"https://api.github.com/repos/tensorflow/tensorboard/assignees{/user}","branches_url":"https://api.github.com/repos/tensorflow/tensorboard/branches{/branch}","tags_url":"https://api.github.com/repos/tensorflow/tensorboard/tags","blobs_url":"https://api.github.com/repos/tensorflow/tensorboard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tensorflow/tensorboard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tensorflow/tensorboard/git/refs{/sha}","trees_url":"https://api.github.com/repos/tensorflow/tensorboard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tensorflow/tensorboard/statuses/{sha}","languages_url":"https://api.github.com/repos/tensorflow/tensorboard/languages","stargazers_url":"https://api.github.com/repos/tensorflow/tensorboard/stargazers","contributors_url":"https://api.github.com/repos/tensorflow/tensorboard/contributors","subscribers_url":"https://api.github.com/repos/tensorflow/tensorboard/subscribers","subscription_url":"https://api.github.com/repos/tensorflow/tensorboard/subscription","commits_url":"https://api.github.com/repos/tensorflow/tensorboard/commits{/sha}","git_commits_url":"https://api.github.com/repos/tensorflow/tensorboard/git/commits{/sha}","comments_url":"https://api.github.com/repos/tensorflow/tensorboard/comments{/number}","issue_comment_url":"https://api.github.com/repos/tensorflow/tensorboard/issues/comments{/number}","contents_url":"https://api.github.com/repos/tensorflow/tensorboard/contents/{+path}","compare_url":"https://api.github.com/repos/tensorflow/tensorboard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tensorflow/tensorboard/merges","archive_url":"https://api.github.com/repos/tensorflow/tensorboard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tensorflow/tensorboard/downloads","issues_url":"https://api.github.com/repos/tensorflow/tensorboard/issues{/number}","pulls_url":"https://api.github.com/repos/tensorflow/tensorboard/pulls{/number}","milestones_url":"https://api.github.com/repos/tensorflow/tensorboard/milestones{/number}","notifications_url":"https://api.github.com/repos/tensorflow/tensorboard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tensorflow/tensorboard/labels{/name}","releases_url":"https://api.github.com/repos/tensorflow/tensorboard/releases{/id}","deployments_url":"https://api.github.com/repos/tensorflow/tensorboard/deployments","created_at":"2017-05-15T20:08:07Z","updated_at":"2017-09-13T17:15:28Z","pushed_at":"2017-09-13T17:44:14Z","git_url":"git://github.com/tensorflow/tensorboard.git","ssh_url":"git@github.com:tensorflow/tensorboard.git","clone_url":"https://github.com/tensorflow/tensorboard.git","svn_url":"https://github.com/tensorflow/tensorboard","homepage":null,"size":6407,"stargazers_count":363,"watchers_count":363,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":120,"mirror_url":null,"open_issues_count":135,"forks":120,"open_issues":135,"watchers":363,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tensorflow/tensorboard/pulls/520"},"html":{"href":"https://github.com/tensorflow/tensorboard/pull/520"},"issue":{"href":"https://api.github.com/repos/tensorflow/tensorboard/issues/520"},"comments":{"href":"https://api.github.com/repos/tensorflow/tensorboard/issues/520/comments"},"review_comments":{"href":"https://api.github.com/repos/tensorflow/tensorboard/pulls/520/comments"},"review_comment":{"href":"https://api.github.com/repos/tensorflow/tensorboard/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tensorflow/tensorboard/pulls/520/commits"},"statuses":{"href":"https://api.github.com/repos/tensorflow/tensorboard/statuses/0dcd119ba2e6dc38a08aefb7809677804c749a7a"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"chihuahua"}}