本文整理汇总了Python中tensorflow.core.framework.summary_pb2.SummaryDescription方法的典型用法代码示例。如果您正苦于以下问题:Python summary_pb2.SummaryDescription方法的具体用法?Python summary_pb2.SummaryDescription怎么用?Python summary_pb2.SummaryDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensorflow.core.framework.summary_pb2
的用法示例。
在下文中一共展示了summary_pb2.SummaryDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_summary_description
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import SummaryDescription [as 别名]
def get_summary_description(node_def):
"""Given a TensorSummary node_def, retrieve its SummaryDescription.
When a Summary op is instantiated, a SummaryDescription of associated
metadata is stored in its NodeDef. This method retrieves the description.
Args:
node_def: the node_def_pb2.NodeDef of a TensorSummary op
Returns:
a summary_pb2.SummaryDescription
Raises:
ValueError: if the node is not a summary op.
"""
if node_def.op != 'TensorSummary':
raise ValueError("Can't get_summary_description on %s" % node_def.op)
description_str = _compat.as_str_any(node_def.attr['description'].s)
summary_description = SummaryDescription()
_json_format.Parse(description_str, summary_description)
return summary_description
示例2: tensor_summary
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import SummaryDescription [as 别名]
def tensor_summary( # pylint: disable=invalid-name
name,
tensor,
summary_description=None,
collections=None):
# pylint: disable=line-too-long
"""Outputs a `Summary` protocol buffer with a serialized tensor.proto.
The generated
[`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto)
has one summary value containing the input tensor.
Args:
name: A name for the generated node. Will also serve as the series name in
TensorBoard.
tensor: A tensor of any type and shape to serialize.
summary_description: Optional summary_pb2.SummaryDescription()
collections: Optional list of graph collections keys. The new summary op is
added to these collections. Defaults to `[GraphKeys.SUMMARIES]`.
Returns:
A scalar `Tensor` of type `string`. The serialized `Summary` protocol
buffer.
"""
# pylint: enable=line-too-long
if summary_description is None:
summary_description = summary_pb2.SummaryDescription()
description = json_format.MessageToJson(summary_description)
with ops.name_scope(name, None, [tensor]) as scope:
val = gen_logging_ops._tensor_summary(
tensor=tensor,
description=description,
name=scope)
_Collect(val, collections, [ops.GraphKeys.SUMMARIES])
return val