提交 f375596a 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!79 Drop histogram steps if original_buckets_count is too large.

Merge pull request !79 from liangyongxiong/master
...@@ -72,6 +72,10 @@ class Bucket: ...@@ -72,6 +72,10 @@ class Bucket:
class HistogramContainer: class HistogramContainer:
# Max quantity of original buckets.
MAX_ORIGINAL_BUCKETS_COUNT = 90
""" """
Histogram data container. Histogram data container.
...@@ -114,6 +118,11 @@ class HistogramContainer: ...@@ -114,6 +118,11 @@ class HistogramContainer:
"""Gets original proto message.""" """Gets original proto message."""
return self._msg return self._msg
@property
def original_buckets_count(self):
"""Gets original buckets quantity."""
return len(self._original_buckets)
def set_visual_range(self, max_val: float, min_val: float, bins: int) -> None: def set_visual_range(self, max_val: float, min_val: float, bins: int) -> None:
""" """
Sets visual range for later re-sampling. Sets visual range for later re-sampling.
......
...@@ -239,14 +239,19 @@ class MSDataLoader: ...@@ -239,14 +239,19 @@ class MSDataLoader:
if value.HasField('histogram'): if value.HasField('histogram'):
histogram_msg = HistogramContainer(value.histogram) histogram_msg = HistogramContainer(value.histogram)
tag = '{}/{}'.format(value.tag, PluginNameEnum.HISTOGRAM.value) # Drop steps if original_buckets_count exceeds HistogramContainer.MAX_ORIGINAL_BUCKETS_COUNT
tensor_event = TensorEvent(wall_time=event.wall_time, # to avoid time-consuming re-sample process.
step=event.step, if histogram_msg.original_buckets_count > HistogramContainer.MAX_ORIGINAL_BUCKETS_COUNT:
tag=tag, logger.warning('original_buckets_count exceeds HistogramContainer.MAX_ORIGINAL_BUCKETS_COUNT')
plugin_name=PluginNameEnum.HISTOGRAM.value, else:
value=histogram_msg, tag = '{}/{}'.format(value.tag, PluginNameEnum.HISTOGRAM.value)
filename=self._latest_summary_filename) tensor_event = TensorEvent(wall_time=event.wall_time,
self._events_data.add_tensor_event(tensor_event) step=event.step,
tag=tag,
plugin_name=PluginNameEnum.HISTOGRAM.value,
value=histogram_msg,
filename=self._latest_summary_filename)
self._events_data.add_tensor_event(tensor_event)
if event.HasField('graph_def'): if event.HasField('graph_def'):
graph_proto = event.graph_def graph_proto = event.graph_def
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册