Пример #1
0
def tensor_summary(
        display_name,  # pylint: disable=invalid-name
        tensor,
        description="",
        labels=None,
        collections=None,
        name=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 input_tensor.

  Args:
    display_name: A name to associate with the data series. Will be used to
      organize output data and as a name in visualizers.
    tensor: A tensor of any type and shape to serialize.
    description: An optional long description of the data being output.
    labels: a list of strings used to specify how the data can be interpreted,
      for example:
      * `'encoding:image/jpg'` for a string tensor containing jpg images
      * `'encoding:proto/X/Y/foo.proto'` for a string tensor containing Foos
      * `'group:$groupName/$roleInGroup'` for a tensor that is related to
         other tensors that are all in a group. (e.g. bounding boxes and images)
    collections: Optional list of graph collections keys. The new summary op is
      added to these collections. Defaults to `[GraphKeys.SUMMARIES]`.
    name: A name for the operation (optional).

  Returns:
    A scalar `Tensor` of type `string`. The serialized `Summary` protocol
    buffer.
  """
    # pylint: enable=line-too-long

    with ops.op_scope([tensor], name, "TensorSummary") as scope:
        val = gen_logging_ops._tensor_summary(display_name=display_name,
                                              tensor=tensor,
                                              description=description,
                                              labels=labels,
                                              name=scope)
        _Collect(val, collections, [ops.GraphKeys.SUMMARIES])
    return val
Пример #2
0
def tensor_summary(display_name,  # pylint: disable=invalid-name
                   tensor,
                   description="",
                   labels=None,
                   collections=None,
                   name=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:
    display_name: A name to associate with the data series. Will be used to
      organize output data and as a name in visualizers.
    tensor: A tensor of any type and shape to serialize.
    description: An optional long description of the data being output.
    labels: a list of strings used to specify how the data can be interpreted,
      for example:
      * `'encoding:image/jpg'` for a string tensor containing jpg images
      * `'encoding:proto/X/Y/foo.proto'` for a string tensor containing Foos
      * `'group:$groupName/$roleInGroup'` for a tensor that is related to
         other tensors that are all in a group. (e.g. bounding boxes and images)
    collections: Optional list of graph collections keys. The new summary op is
      added to these collections. Defaults to `[GraphKeys.SUMMARIES]`.
    name: An optional name for the generated node (optional).

  Returns:
    A scalar `Tensor` of type `string`. The serialized `Summary` protocol
    buffer.
  """
  # pylint: enable=line-too-long

  with ops.name_scope(name, "TensorSummary", [tensor]) as scope:
    val = gen_logging_ops._tensor_summary(
        display_name=display_name,
        tensor=tensor,
        description=description,
        labels=labels,
        name=scope)
    _Collect(val, collections, [ops.GraphKeys.SUMMARIES])
  return val
Пример #3
0
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