diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2017-08-08 16:12:36 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-08-08 16:17:08 -0700 |
commit | 4c60c96257bfd54a036d15af979e90fc0b4e400d (patch) | |
tree | d55d5220e715eacf71e9b79ba7737caa5727e986 /tensorflow/core/debug | |
parent | de5034aee81859ab8f6c1d910d69c7c198cf4d04 (diff) |
Make plugin_data an optional field of SummaryMetadata
Every summary op writes data for a single plugin to process. Hence, each SummaryMetadata proto should have a single PluginData optional field (instead of a repeated one). This removes much complexity from TensorBoard logic that loops over the plugin data. It also simplifies the SQL schema - it can now enforce a one-to-one relationship between summary op and plugin.
PiperOrigin-RevId: 164659570
Diffstat (limited to 'tensorflow/core/debug')
-rw-r--r-- | tensorflow/core/debug/debug_grpc_testlib.cc | 20 | ||||
-rw-r--r-- | tensorflow/core/debug/debug_io_utils.cc | 2 | ||||
-rw-r--r-- | tensorflow/core/debug/debug_io_utils_test.cc | 7 |
3 files changed, 13 insertions, 16 deletions
diff --git a/tensorflow/core/debug/debug_grpc_testlib.cc b/tensorflow/core/debug/debug_grpc_testlib.cc index 7317aa0372..acfbf7852b 100644 --- a/tensorflow/core/debug/debug_grpc_testlib.cc +++ b/tensorflow/core/debug/debug_grpc_testlib.cc @@ -56,17 +56,15 @@ namespace test { // Obtain the device name, which is encoded in JSON. third_party::tensorflow::core::debug::DebuggerEventMetadata metadata; - for (int i = 0; i < val.metadata().plugin_data_size(); i++) { - if (val.metadata().plugin_data(i).plugin_name() != "debugger") { - // This plugin data was meant for another plugin. - continue; - } - auto status = tensorflow::protobuf::util::JsonStringToMessage( - val.metadata().plugin_data(i).content(), &metadata); - if (status.ok()) { - // The device name has been determined. - break; - } + if (val.metadata().plugin_data().plugin_name() != "debugger") { + // This plugin data was meant for another plugin. + continue; + } + auto status = tensorflow::protobuf::util::JsonStringToMessage( + val.metadata().plugin_data().content(), &metadata); + if (!status.ok()) { + // The device name could not be determined. + continue; } device_names.push_back(metadata.device()); diff --git a/tensorflow/core/debug/debug_io_utils.cc b/tensorflow/core/debug/debug_io_utils.cc index f4208a0bbc..98ef68a9aa 100644 --- a/tensorflow/core/debug/debug_io_utils.cc +++ b/tensorflow/core/debug/debug_io_utils.cc @@ -83,7 +83,7 @@ Event PrepareChunkEventProto(const DebugNodeKey& debug_node_key, if (status.ok()) { // Store summary metadata. Set the plugin to use this data as "debugger". SummaryMetadata::PluginData* plugin_data = - value->mutable_metadata()->add_plugin_data(); + value->mutable_metadata()->mutable_plugin_data(); plugin_data->set_plugin_name(DebugIO::kDebuggerPluginName); plugin_data->set_content(json_output); } else { diff --git a/tensorflow/core/debug/debug_io_utils_test.cc b/tensorflow/core/debug/debug_io_utils_test.cc index 08ef4001bc..df6fb1d2fe 100644 --- a/tensorflow/core/debug/debug_io_utils_test.cc +++ b/tensorflow/core/debug/debug_io_utils_test.cc @@ -132,7 +132,7 @@ TEST_F(DebugIOUtilsTest, DumpStringTensorToFileSunnyDay) { // Determine and validate some information from the metadata. third_party::tensorflow::core::debug::DebuggerEventMetadata metadata; auto status = tensorflow::protobuf::util::JsonStringToMessage( - event.summary().value(0).metadata().plugin_data(0).content(), &metadata); + event.summary().value(0).metadata().plugin_data().content(), &metadata); ASSERT_TRUE(status.ok()); ASSERT_EQ(kDebugNodeKey.device_name, metadata.device()); ASSERT_EQ(kDebugNodeKey.output_slot, metadata.output_slot()); @@ -245,8 +245,7 @@ TEST_F(DebugIOUtilsTest, PublishTensorToMultipleFileURLs) { // Determine and validate some information from the metadata. third_party::tensorflow::core::debug::DebuggerEventMetadata metadata; auto status = tensorflow::protobuf::util::JsonStringToMessage( - event.summary().value(0).metadata().plugin_data(0).content(), - &metadata); + event.summary().value(0).metadata().plugin_data().content(), &metadata); ASSERT_TRUE(status.ok()); ASSERT_EQ(kDebugNodeKey.device_name, metadata.device()); ASSERT_EQ(kDebugNodeKey.output_slot, metadata.output_slot()); @@ -358,7 +357,7 @@ TEST_F(DebugIOUtilsTest, PublishTensorConcurrentlyToPartiallyOverlappingPaths) { // Determine and validate some information from the metadata. third_party::tensorflow::core::debug::DebuggerEventMetadata metadata; auto status = tensorflow::protobuf::util::JsonStringToMessage( - event.summary().value(0).metadata().plugin_data(0).content(), + event.summary().value(0).metadata().plugin_data().content(), &metadata); ASSERT_TRUE(status.ok()); ASSERT_EQ(kDebugNodeKey.device_name, metadata.device()); |