Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions tensorboard/plugins/histogram/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@


# Export V2 versions.
histogram = summary_v2.histogram
histogram_pb = summary_v2.histogram_pb
histogram_v2 = summary_v2.histogram_v2

# Export V3 versions.
histogram_v3 = summary_v2.histogram_v3
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


# Export the default versions.
histogram = summary_v2.histogram
histogram_pb = summary_v2.histogram_pb


def _buckets(data, bucket_count=None):
"""Create a TensorFlow op to group data into histogram buckets.
Expand Down
4 changes: 2 additions & 2 deletions tensorboard/plugins/histogram/summary_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def write_histogram_event(self, *args, **kwargs):
writer.close()

def call_histogram_op(self, *args, **kwargs):
summary.histogram(*args, **kwargs)
summary.histogram_v2(*args, **kwargs)

def test_scoped_tag(self):
with tf.name_scope("scope"):
Expand Down Expand Up @@ -306,7 +306,7 @@ def graph_fn():

class SummaryV3OpTest(SummaryV2OpTest, tf.test.TestCase):
def call_histogram_op(self, *args, **kwargs):
summary.histogram_v3(*args, **kwargs)
summary.histogram(*args, **kwargs)

def test_singleton_input(self):
pb = self.histogram("twelve", [12])
Expand Down
6 changes: 5 additions & 1 deletion tensorboard/plugins/histogram/summary_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
DEFAULT_BUCKET_COUNT = 30


def histogram(name, data, step=None, buckets=None, description=None):
def histogram_v2(name, data, step=None, buckets=None, description=None):
"""Write a histogram summary.

See also `tf.summary.scalar`, `tf.summary.SummaryWriter`.
Expand Down Expand Up @@ -507,3 +507,7 @@ def when_single_value():
)

return tf.cond(is_empty, when_empty, when_nonempty)


# Set V3 as default.
histogram = histogram_v3
16 changes: 10 additions & 6 deletions tensorboard/plugins/metrics/metrics_plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,14 @@ def test_time_series_histogram(self):
)
clean_response = self._clean_time_series_responses(response)

# By default 30 bins will be generated.
bins_zero = [{"min": 0, "max": 0, "count": 0}] * 29 + [
{"min": 0, "max": 0, "count": 1.0}
]
bins_ten = [{"min": 10, "max": 10, "count": 0}] * 29 + [
{"min": 10, "max": 10, "count": 1.0}
]

self.assertEqual(
[
{
Expand All @@ -431,16 +439,12 @@ def test_time_series_histogram(self):
{
"wallTime": "<wall_time>",
"step": 0,
"bins": [
{"min": -0.5, "max": 0.5, "count": 1.0}
],
"bins": bins_zero,
},
{
"wallTime": "<wall_time>",
"step": 1,
"bins": [
{"min": 9.5, "max": 10.5, "count": 1.0}
],
"bins": bins_ten,
},
]
},
Expand Down