本文整理汇总了Python中tensorflow.core.util.event_pb2.TaggedRunMetadata方法的典型用法代码示例。如果您正苦于以下问题:Python event_pb2.TaggedRunMetadata方法的具体用法?Python event_pb2.TaggedRunMetadata怎么用?Python event_pb2.TaggedRunMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensorflow.core.util.event_pb2
的用法示例。
在下文中一共展示了event_pb2.TaggedRunMetadata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_run_metadata
# 需要导入模块: from tensorflow.core.util import event_pb2 [as 别名]
# 或者: from tensorflow.core.util.event_pb2 import TaggedRunMetadata [as 别名]
def add_run_metadata(self, run_metadata, tag, global_step=None):
"""Adds a metadata information for a single session.run() call.
Args:
run_metadata: A `RunMetadata` protobuf object.
tag: The tag name for this metadata.
global_step: Number. Optional global step counter to record with the
StepStats.
Raises:
ValueError: If the provided tag was already used for this type of event.
"""
if tag in self._session_run_tags:
raise ValueError("The provided tag was already used for this event type")
self._session_run_tags[tag] = True
tagged_metadata = event_pb2.TaggedRunMetadata()
tagged_metadata.tag = tag
# Store the `RunMetadata` object as bytes in order to have postponed
# (lazy) deserialization when used later.
tagged_metadata.run_metadata = run_metadata.SerializeToString()
event = event_pb2.Event(tagged_run_metadata=tagged_metadata)
self._add_event(event, global_step)
示例2: add_run_metadata
# 需要导入模块: from tensorflow.core.util import event_pb2 [as 别名]
# 或者: from tensorflow.core.util.event_pb2 import TaggedRunMetadata [as 别名]
def add_run_metadata(self, run_metadata, tag, global_step=None):
"""Adds a metadata information for a single session.run() call.
Args:
run_metadata: A `RunMetadata` protobuf object.
tag: The tag name for this metadata.
global_step: Number. Optional global step counter to record with the
StepStats.
Raises:
ValueError: If the provided tag was already used for this type of event.
"""
if tag in self._session_run_tags:
raise ValueError("The provided tag was already used for this event type")
self._session_run_tags[tag] = True
tagged_metadata = event_pb2.TaggedRunMetadata()
tagged_metadata.tag = tag
# Store the `RunMetadata` object as bytes in order to have postponed
# (lazy) deserialization when used later.
tagged_metadata.run_metadata = run_metadata.SerializeToString()
event = event_pb2.Event(wall_time=time.time(),
tagged_run_metadata=tagged_metadata)
if global_step is not None:
event.step = int(global_step)
self._event_queue.put(event)