Exemplo n.º 1
0
  def _CreateEventWithDebugNumericSummary(
      self, device_name, op_name, output_slot, wall_time, step, list_of_values):
    """Creates event with a health pill summary.

    Args:
      device_name: The name of the op's device.
      op_name: The name of the op to which a DebugNumericSummary was attached.
      output_slot: The numeric output slot for the tensor.
      wall_time: The numeric wall time of the event.
      step: The step of the event.
      list_of_values: A python list of values within the tensor.

    Returns:
      A `tf.Event` with a health pill summary.
    """
    event = tf.Event(step=step, wall_time=wall_time)
    value = event.summary.value.add(
        tag=op_name,
        node_name='%s:%d:DebugNumericSummary' % (op_name, output_slot),
        tensor=tf.make_tensor_proto(
            list_of_values, dtype=tf.float64, shape=[len(list_of_values)]))
    content_proto = debugger_event_metadata_pb2.DebuggerEventMetadata(
        device=device_name, output_slot=output_slot)
    value.metadata.plugin_data.plugin_name = constants.DEBUGGER_PLUGIN_NAME
    value.metadata.plugin_data.content = tf.compat.as_bytes(
        json_format.MessageToJson(
            content_proto, including_default_value_fields=True))
    return event
  def _create_event_with_float_tensor(self, node_name, output_slot, debug_op,
                                      list_of_values):
    """Creates event with float64 (double) tensors.

    Args:
      node_name: The string name of the op. This lacks both the output slot as
        well as the name of the debug op.
      output_slot: The number that is the output slot.
      debug_op: The name of the debug op to use.
      list_of_values: A python list of values within the tensor.
    Returns:
      A `tf.Event` with a summary containing that node name and a float64
      tensor with those values.
    """
    event = tf.Event()
    value = event.summary.value.add(
        tag=node_name,
        node_name="%s:%d:%s" % (node_name, output_slot, debug_op),
        tensor=tensor_util.make_tensor_proto(
            list_of_values, dtype=tf.float64, shape=[len(list_of_values)]))
    plugin_content = debugger_event_metadata_pb2.DebuggerEventMetadata(
        device="/job:localhost/replica:0/task:0/cpu:0", output_slot=output_slot)
    value.metadata.plugin_data.plugin_name = constants.DEBUGGER_PLUGIN_NAME
    value.metadata.plugin_data.content = tf.compat.as_bytes(
        json_format.MessageToJson(
            plugin_content, including_default_value_fields=True))
    return event