aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Dandelion Man? <dandelion@google.com>2017-06-05 11:20:17 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-06-05 11:23:47 -0700
commit88bdb6fca2378670d50f50f1960b55efb254da50 (patch)
treefeba9c9f146c4281dfda16e6d0b26e643412c312
parent6c531eb2fc4fefc770dd2e07d44875e9ed86cb4c (diff)
Remove all remaining references to non-public TF modules from TensorBoard.
I deleted the PluginAssetUtil tests because that code is deprecated. I'll later add manual testing for backcompat in the text plugin. PiperOrigin-RevId: 158037466
-rw-r--r--tensorflow/tensorboard/backend/application_test.py3
-rw-r--r--tensorflow/tensorboard/backend/event_processing/BUILD12
-rw-r--r--tensorflow/tensorboard/backend/event_processing/event_accumulator_test.py10
-rw-r--r--tensorflow/tensorboard/backend/event_processing/plugin_asset_util_test.py119
-rw-r--r--tensorflow/tensorboard/plugins/scalars/scalars_demo.py4
-rw-r--r--tensorflow/tensorboard/plugins/text/text_plugin.py3
6 files changed, 9 insertions, 142 deletions
diff --git a/tensorflow/tensorboard/backend/application_test.py b/tensorflow/tensorboard/backend/application_test.py
index 87cfdbc1d8..63eb47e9d4 100644
--- a/tensorflow/tensorboard/backend/application_test.py
+++ b/tensorflow/tensorboard/backend/application_test.py
@@ -36,7 +36,6 @@ import tensorflow as tf
from werkzeug import serving
-from tensorflow.core.protobuf import meta_graph_pb2
from tensorflow.tensorboard import tensorboard
from tensorflow.tensorboard.backend import application
from tensorflow.tensorboard.backend.event_processing import event_multiplexer
@@ -221,7 +220,7 @@ class TensorboardServerTest(tf.test.TestCase):
node2.name = 'b'
node2.attr['very_large_attr'].s = b'a' * 2048 # 2 KB attribute
- meta_graph_def = meta_graph_pb2.MetaGraphDef(graph_def=graph_def)
+ meta_graph_def = tf.MetaGraphDef(graph_def=graph_def)
if self._only_use_meta_graph:
writer.add_meta_graph(meta_graph_def)
diff --git a/tensorflow/tensorboard/backend/event_processing/BUILD b/tensorflow/tensorboard/backend/event_processing/BUILD
index 1c3e094e76..dff2dbc90d 100644
--- a/tensorflow/tensorboard/backend/event_processing/BUILD
+++ b/tensorflow/tensorboard/backend/event_processing/BUILD
@@ -134,18 +134,6 @@ py_library(
],
)
-py_test(
- name = "plugin_asset_util_test",
- size = "small",
- srcs = ["plugin_asset_util_test.py"],
- srcs_version = "PY2AND3",
- deps = [
- ":event_multiplexer",
- ":plugin_asset_util",
- "//tensorflow:tensorflow_py",
- ],
-)
-
py_library(
name = "event_file_inspector",
srcs = ["event_file_inspector.py"],
diff --git a/tensorflow/tensorboard/backend/event_processing/event_accumulator_test.py b/tensorflow/tensorboard/backend/event_processing/event_accumulator_test.py
index 9efd64bd2e..4ce766f420 100644
--- a/tensorflow/tensorboard/backend/event_processing/event_accumulator_test.py
+++ b/tensorflow/tensorboard/backend/event_processing/event_accumulator_test.py
@@ -24,7 +24,6 @@ import six
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
-from tensorflow.python.summary.writer.writer import SummaryToEventTransformer
from tensorflow.tensorboard.backend.event_processing import event_accumulator as ea
@@ -760,7 +759,8 @@ class MockingEventAccumulatorTest(EventAccumulatorTest):
def testTFSummaryScalar(self):
"""Verify processing of tf.summary.scalar."""
event_sink = _EventGenerator(self, zero_out_timestamps=True)
- writer = SummaryToEventTransformer(event_sink)
+ writer = tf.summary.FileWriter(self.get_temp_dir())
+ writer.event_writer = event_sink
with self.test_session() as sess:
ipt = tf.placeholder(tf.float32)
tf.summary.scalar('scalar1', ipt)
@@ -794,7 +794,8 @@ class MockingEventAccumulatorTest(EventAccumulatorTest):
def testTFSummaryImage(self):
"""Verify processing of tf.summary.image."""
event_sink = _EventGenerator(self, zero_out_timestamps=True)
- writer = SummaryToEventTransformer(event_sink)
+ writer = tf.summary.FileWriter(self.get_temp_dir())
+ writer.event_writer = event_sink
with self.test_session() as sess:
ipt = tf.ones([10, 4, 4, 3], tf.uint8)
# This is an interesting example, because the old tf.image_summary op
@@ -830,7 +831,8 @@ class MockingEventAccumulatorTest(EventAccumulatorTest):
def testTFSummaryTensor(self):
"""Verify processing of tf.summary.tensor."""
event_sink = _EventGenerator(self, zero_out_timestamps=True)
- writer = SummaryToEventTransformer(event_sink)
+ writer = tf.summary.FileWriter(self.get_temp_dir())
+ writer.event_writer = event_sink
with self.test_session() as sess:
tf.summary.tensor_summary('scalar', tf.constant(1.0))
tf.summary.tensor_summary('vector', tf.constant([1.0, 2.0, 3.0]))
diff --git a/tensorflow/tensorboard/backend/event_processing/plugin_asset_util_test.py b/tensorflow/tensorboard/backend/event_processing/plugin_asset_util_test.py
deleted file mode 100644
index 8fe5b31621..0000000000
--- a/tensorflow/tensorboard/backend/event_processing/plugin_asset_util_test.py
+++ /dev/null
@@ -1,119 +0,0 @@
-# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import os.path
-
-import tensorflow as tf
-
-from tensorflow.python.summary import plugin_asset
-
-from tensorflow.tensorboard.backend.event_processing import event_multiplexer
-from tensorflow.tensorboard.backend.event_processing import plugin_asset_util
-
-
-class GenericContentPlugin(plugin_asset.PluginAsset):
-
- def __init__(self):
- self.contents = "hello world"
-
- def assets(self):
- return {"contents.txt": self.contents}
-
-
-class PluginAlpha(GenericContentPlugin):
- plugin_name = "Alpha"
-
-
-class PluginBeta(GenericContentPlugin):
- plugin_name = "Beta"
-
-
-class PluginGamma(GenericContentPlugin):
- plugin_name = "Gamma"
-
-
-class PluginAssetUtilitiesTest(tf.test.TestCase):
-
- def testGetPluginDirectory(self):
- self.assertEqual(
- os.path.join("logdir", "plugins", "x"),
- plugin_asset_util.PluginDirectory("logdir", "x"))
-
- def testNonExistentDirectory(self):
- tempdir = self.get_temp_dir()
- fake_dir = os.path.join(tempdir, "nonexistent_dir")
- self.assertEqual([], plugin_asset_util.ListPlugins(fake_dir))
- self.assertEqual([], plugin_asset_util.ListAssets(fake_dir, "fake_plugin"))
- with self.assertRaises(KeyError):
- plugin_asset_util.RetrieveAsset(fake_dir, "fake_plugin", "fake_asset")
-
- def testSimplePluginCase(self):
- tempdir = self.get_temp_dir()
- with tf.Graph().as_default() as g:
- plugin_asset.get_plugin_asset(PluginAlpha)
- fw = tf.summary.FileWriter(tempdir)
- fw.add_graph(g)
- self.assertEqual(["Alpha"], plugin_asset_util.ListPlugins(tempdir))
- assets = plugin_asset_util.ListAssets(tempdir, "Alpha")
- self.assertEqual(["contents.txt"], assets)
- contents = plugin_asset_util.RetrieveAsset(tempdir, "Alpha", "contents.txt")
- self.assertEqual("hello world", contents)
-
- def testEventMultiplexerIntegration(self):
- tempdir = self.get_temp_dir()
- with tf.Graph().as_default() as g:
- plugin_instance = plugin_asset.get_plugin_asset(PluginAlpha)
- plugin_instance.contents = "graph one"
- plugin_asset.get_plugin_asset(PluginBeta)
-
- fw = tf.summary.FileWriter(os.path.join(tempdir, "one"))
- fw.add_graph(g)
- fw.close()
-
- with tf.Graph().as_default() as g:
- plugin_instance = plugin_asset.get_plugin_asset(PluginAlpha)
- plugin_instance.contents = "graph two"
- fw = tf.summary.FileWriter(os.path.join(tempdir, "two"))
- fw.add_graph(g)
- fw.close()
-
- multiplexer = event_multiplexer.EventMultiplexer()
- multiplexer.AddRunsFromDirectory(tempdir)
-
- self.assertEqual(
- multiplexer.PluginAssets("Alpha"),
- {"one": ["contents.txt"], "two": ["contents.txt"]})
- self.assertEqual(
- multiplexer.RetrievePluginAsset("one", "Alpha", "contents.txt"),
- "graph one")
- self.assertEqual(
- multiplexer.RetrievePluginAsset("one", "Beta", "contents.txt"),
- "hello world")
- self.assertEqual(
- multiplexer.RetrievePluginAsset("two", "Alpha", "contents.txt"),
- "graph two")
-
- self.assertEqual(
- multiplexer.PluginAssets("Beta"),
- {"one": ["contents.txt"], "two": []})
- self.assertEqual(multiplexer.PluginAssets("Gamma"), {"one": [], "two": []})
-
-
-if __name__ == "__main__":
- tf.test.main()
diff --git a/tensorflow/tensorboard/plugins/scalars/scalars_demo.py b/tensorflow/tensorboard/plugins/scalars/scalars_demo.py
index e9b2a6129d..f3195fd849 100644
--- a/tensorflow/tensorboard/plugins/scalars/scalars_demo.py
+++ b/tensorflow/tensorboard/plugins/scalars/scalars_demo.py
@@ -23,8 +23,6 @@ import os.path
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
-from tensorflow.python.platform import app
-
# Directory into which to write tensorboard data.
LOGDIR = '/tmp/scalars_demo'
@@ -129,4 +127,4 @@ def main(unused_argv):
if __name__ == '__main__':
- app.run()
+ tf.app.run()
diff --git a/tensorflow/tensorboard/plugins/text/text_plugin.py b/tensorflow/tensorboard/plugins/text/text_plugin.py
index 2c11b80029..d0040e20be 100644
--- a/tensorflow/tensorboard/plugins/text/text_plugin.py
+++ b/tensorflow/tensorboard/plugins/text/text_plugin.py
@@ -35,7 +35,6 @@ import six
import tensorflow as tf
from werkzeug import wrappers
-from tensorflow.python.summary import text_summary
from tensorflow.tensorboard.backend import http_util
from tensorflow.tensorboard.plugins import base_plugin
@@ -256,7 +255,7 @@ class TextPlugin(base_plugin.TBPlugin):
def index_impl(self):
run_to_series = {}
- name = text_summary.TextSummaryPluginAsset.plugin_name
+ name = 'tensorboard_text'
run_to_assets = self.multiplexer.PluginAssets(name)
for run, assets in run_to_assets.items():