-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
histogram: set v3 as default #5415
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,20 @@ | |
|
||
A histogram summary stores a list of buckets. Each bucket is encoded as | ||
a triple `[left_edge, right_edge, count]`. Thus, a full histogram is | ||
encoded as a tensor of dimension `[k, 3]`. | ||
encoded as a tensor of dimension `[k, 3]`, where the first `k - 1` buckets | ||
are closed-open and the last bucket is closed-closed. | ||
|
||
In general, the value of `k` (the number of buckets) will be a constant, | ||
like 30. There are two edge cases: if there is no data, then there are | ||
no buckets (the shape is `[0, 3]`); and if there is data but all points | ||
have the same value, then there is one bucket whose left and right | ||
endpoints are the same (the shape is `[1, 3]`). | ||
like 30. For V2 format (deprecated), there are two edge cases: if there | ||
is no data, then there are no buckets (the shape is `[0, 3]`); and if | ||
there is data but all points have the same value, then there is one | ||
bucket whose left and right endpoints are the same (the shape is `[1, 3]`). | ||
|
||
For V3 format, the shape of the output histogram is always constant (`[k, 3]`). | ||
In the case of empty data, the output will be an all-zero histogram of shape | ||
`[k, 3]`, where all edges and counts are zeros. If there is data but all points | ||
have the same value, then all buckets' left and right edges are the same and | ||
only the last bucket has nonzero count. | ||
|
||
NOTE: This module is in beta, and its API is subject to change, but the | ||
data that it stores to disk will be supported forever. | ||
|
@@ -35,13 +42,10 @@ | |
from tensorboard.plugins.histogram import summary_v2 | ||
|
||
|
||
# Export V2 versions. | ||
# Export the latest versions. | ||
histogram = summary_v2.histogram | ||
histogram_pb = summary_v2.histogram_pb | ||
|
||
# Export V3 versions. | ||
histogram_v3 = summary_v2.histogram_v3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep this one line for now, so that anyone who was testing this out internally won't be broken by this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
|
||
def _buckets(data, bucket_count=None): | ||
"""Create a TensorFlow op to group data into histogram buckets. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module docstring is all referring to the legacy "tb.summary" APIs (for TensorFlow 1.x) that were defined in this file, which we aren't changing, so I think it's ok to just leave this docstring as-is (and only have the new format documented in summary_v2.py's docstring). At some point we should rearrange and clean this up so that's more obvious but probably best to do that for all the summary APIs vs piecemeal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks for the suggestion!