tensorflow/core/debug/debug_io_utils.cc
// Creates an Event proto representing a chunk of a Tensor. This method only
// populates the field of the Event proto that represent the envelope
// information (e.g., timestamp, device_name, num_chunks, chunk_index, dtype,
// shape). It does not set the value.tensor field, which should be set by the
// caller separately.
Creates an Event proto representing a chunk of a Tensor. This method only
populates the field of the Event proto that represent the envelope
information . It does not set the value.tensor field, which should be set by the
caller separately.
Creates an Event proto representing a chunk of a Tensor . This method only populates the field of the Event proto that represent the envelope information . It does not set the value . tensor field which should be set by the caller separately .
Event PrepareChunkEventProto(const DebugNodeKey& debug_node_key,
                             const uint64 wall_time_us, const size_t num_chunks,
                             const size_t chunk_index,
                             const DataType& tensor_dtype,
                             const TensorShapeProto& tensor_shape) {
  Event event;
  event.set_wall_time(static_cast<double>(wall_time_us));
  Summary::Value* value = event.mutable_summary()->add_value();
  value->set_node_name(debug_node_key.debug_node_name);
  value->set_tag(debug_node_key.node_name);
  third_party::tensorflow::core::debug::DebuggerEventMetadata metadata;
  metadata.set_device(debug_node_key.device_name);
  metadata.set_output_slot(debug_node_key.output_slot);
  metadata.set_num_chunks(num_chunks);
  metadata.set_chunk_index(chunk_index);
  string json_output;
  tensorflow::protobuf::util::JsonPrintOptions json_options;
  json_options.always_print_primitive_fields = true;
  auto status = tensorflow::protobuf::util::MessageToJsonString(
      metadata, &json_output, json_options);
  if (status.ok()) {
    SummaryMetadata::PluginData* plugin_data =
        value->mutable_metadata()->mutable_plugin_data();
    plugin_data->set_plugin_name(DebugIO::kDebuggerPluginName);
    plugin_data->set_content(json_output);
  } else {
    LOG(WARNING) << "Failed to convert DebuggerEventMetadata proto to JSON. "
                 << "The debug_node_name is " << debug_node_key.debug_node_name
                 << ".";
  }
  value->mutable_tensor()->set_dtype(tensor_dtype);
  *value->mutable_tensor()->mutable_tensor_shape() = tensor_shape;
  return event;
}
Event PrepareChunkEventProto ( const DebugNodeKey & debug_node_key , const uint64 wall_time_us , const size_t num_chunks , const size_t chunk_index , const DataType & tensor_dtype , const TensorShapeProto & tensor_shape ) { Event event ; event . set_wall_time ( static_cast < double > ( wall_time_us ) ) ; Summary :: Value * value = event . mutable_summary ( ) -> add_value ( ) ; value -> set_node_name ( debug_node_key . debug_node_name ) ; value -> set_tag ( debug_node_key . node_name ) ; third_party :: tensorflow :: core :: debug :: DebuggerEventMetadata metadata ; metadata . set_device ( debug_node_key . device_name ) ; metadata . set_output_slot ( debug_node_key . output_slot ) ; metadata . set_num_chunks ( num_chunks ) ; metadata . set_chunk_index ( chunk_index ) ; string json_output ; tensorflow :: protobuf :: util :: JsonPrintOptions json_options ; json_options . always_print_primitive_fields = true ; auto status = tensorflow :: protobuf :: util :: MessageToJsonString ( metadata , & json_output , json_options ) ; if ( status . ok ( ) ) { SummaryMetadata :: PluginData * plugin_data = value -> mutable_metadata ( ) -> mutable_plugin_data ( ) ; plugin_data -> set_plugin_name ( DebugIO :: kDebuggerPluginName ) ; plugin_data -> set_content ( json_output ) ; } else { LOG ( WARNING ) << " " << " " << debug_node_key . debug_node_name << " " ; } value -> mutable_tensor ( ) -> set_dtype ( tensor_dtype ) ; * value -> mutable_tensor ( ) -> mutable_tensor_shape ( ) = tensor_shape ; return event ; }
Creates an Event proto representing a chunk of a Tensor.
Creates an Event proto representing a chunk of a Tensor .
// Create the debug node_name in the Summary proto. // For example, if tensor_name = "foo/node_a:0", and the debug_op is // "DebugIdentity", the debug node_name in the Summary proto will be // "foo/node_a:0:DebugIdentity". // Tag by the node name. This allows TensorBoard to quickly fetch data // per op. // Store data within debugger metadata to be stored for each event. // Encode the data in JSON. // Store summary metadata. Set the plugin to use this data as "debugger".