From d84a0eb0dcd758d45e0b3f1bec97aab4298c6b7f Mon Sep 17 00:00:00 2001 From: James Wexler Date: Mon, 19 Mar 2018 19:38:11 +0100 Subject: [PATCH 1/6] Add flags to TBContext --- tensorboard/plugins/base_plugin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tensorboard/plugins/base_plugin.py b/tensorboard/plugins/base_plugin.py index 2792a5a337..2e16bc7cd5 100644 --- a/tensorboard/plugins/base_plugin.py +++ b/tensorboard/plugins/base_plugin.py @@ -87,6 +87,7 @@ def __init__( db_connection_provider=None, db_module=None, db_uri=None, + flags=None, logdir=None, multiplexer=None, plugin_name_to_instance=None, @@ -115,6 +116,8 @@ def __init__( not in SQL mode and multiplexer should be used instead. db_uri: The string db URI TensorBoard was started with. If this is set, the logdir should be None. + flags: A dict of the runtime flags provided to TensorBoard to their + values. logdir: The string logging directory TensorBoard was started with. If this is set, the db_uri should be None. multiplexer: An EventMultiplexer with underlying TB data. Plugins should @@ -131,6 +134,7 @@ def __init__( self.db_connection_provider = db_connection_provider self.db_module = db_module self.db_uri = db_uri + self.flags = flags self.logdir = logdir self.multiplexer = multiplexer self.plugin_name_to_instance = plugin_name_to_instance From ab0e9cfa87eb52d096b9c605f6d48b4c4d3c9bd4 Mon Sep 17 00:00:00 2001 From: James Wexler Date: Mon, 19 Mar 2018 19:41:30 +0100 Subject: [PATCH 2/6] Add flags to TBContext in application --- tensorboard/backend/application.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tensorboard/backend/application.py b/tensorboard/backend/application.py index fa470a2b5c..ef8ddd1fdc 100644 --- a/tensorboard/backend/application.py +++ b/tensorboard/backend/application.py @@ -79,7 +79,8 @@ def standard_tensorboard_wsgi( db_uri="", assets_zip_provider=None, path_prefix="", - window_title=""): + window_title="", + flags=None): """Construct a TensorBoardWSGIApp with standard plugins and multiplexer. Args: @@ -96,7 +97,7 @@ def standard_tensorboard_wsgi( the `tensorboard.default` module to use the default. This behavior might be removed in the future. window_title: A string specifying the the window title. - + flags: A dict of the runtime flags provided to the application, or None. Returns: The new TensorBoard WSGI application. """ @@ -116,6 +117,7 @@ def standard_tensorboard_wsgi( db_module=db_module, db_connection_provider=db_connection_provider, db_uri=db_uri, + flags=flags, logdir=logdir, multiplexer=multiplexer, assets_zip_provider=assets_zip_provider, From e72cbcf37adca9a3e30e5cf4af20010187bf1939 Mon Sep 17 00:00:00 2001 From: James Wexler Date: Mon, 19 Mar 2018 19:54:43 +0100 Subject: [PATCH 3/6] Add flags to tbcontext --- tensorboard/program.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tensorboard/program.py b/tensorboard/program.py index aade1e3114..3acedcc193 100644 --- a/tensorboard/program.py +++ b/tensorboard/program.py @@ -197,7 +197,8 @@ def create_tb_app(plugins, assets_zip_provider=None): reload_interval=FLAGS.reload_interval, plugins=plugins, path_prefix=FLAGS.path_prefix, - window_title=FLAGS.window_title) + window_title=FLAGS.window_title, + flags=FLAGS) def make_simple_server(tb_app, host=None, port=None, path_prefix=None): From 3803ab7c3c16455bd114c49ae78ae142c9160a3a Mon Sep 17 00:00:00 2001 From: James Wexler Date: Wed, 11 Apr 2018 11:42:46 -0400 Subject: [PATCH 4/6] gitignore changes --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 70436598bc..a11f9dc0e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /bazel-* /.idea *.pyc -*.egg-info/ \ No newline at end of file +*.egg-info/ +.vscode/ +tensorboard/tf From c0c825826113139e6ec64ff2f6f857373f3f02ac Mon Sep 17 00:00:00 2001 From: James Wexler Date: Mon, 6 Aug 2018 15:39:34 -0400 Subject: [PATCH 5/6] jwexler updated rules_closure version --- WORKSPACE | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 91d43122e8..d1bbc01031 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -2,11 +2,11 @@ workspace(name = "org_tensorflow_tensorboard") http_archive( name = "io_bazel_rules_closure", - sha256 = "a80acb69c63d5f6437b099c111480a4493bad4592015af2127a2f49fb7512d8d", - strip_prefix = "rules_closure-0.7.0", + sha256 = "b29a8bc2cb10513c864cb1084d6f38613ef14a143797cea0af0f91cd385f5e8c", + strip_prefix = "rules_closure-0.8.0", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/0.7.0.tar.gz", - "https://github.com/bazelbuild/rules_closure/archive/0.7.0.tar.gz", # 2018-05-09 + "https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/0.8.0.tar.gz", + "https://github.com/bazelbuild/rules_closure/archive/0.8.0.tar.gz", # 2018-08-06 ], ) From 5cc285e665e83cc8e676e11f4259d56e89d14502 Mon Sep 17 00:00:00 2001 From: James Wexler Date: Fri, 28 Sep 2018 15:36:22 -0400 Subject: [PATCH 6/6] Fill in index labels when labels are blank --- .../tf-interactive-inference-dashboard.html | 7 +++++++ .../plugins/interactive_inference/utils/inference_utils.py | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tensorboard/plugins/interactive_inference/tf_interactive_inference_dashboard/tf-interactive-inference-dashboard.html b/tensorboard/plugins/interactive_inference/tf_interactive_inference_dashboard/tf-interactive-inference-dashboard.html index 54734d90d1..320db0e8c3 100644 --- a/tensorboard/plugins/interactive_inference/tf_interactive_inference_dashboard/tf-interactive-inference-dashboard.html +++ b/tensorboard/plugins/interactive_inference/tf_interactive_inference_dashboard/tf-interactive-inference-dashboard.html @@ -2842,6 +2842,13 @@

Create a distance feature

for (let i = 0; i < this.inferences.indices.length; i++) { if (isClassification) { const result = this.inferences.results.classificationResult; + // For models that don't return any labels for the classes, fill + // them out with class indicies. + for (let j = 0; j < result.classifications[i].classes.length; j++) { + if (result.classifications[i].classes[j].label == '') { + result.classifications[i].classes[j].label = j.toString(); + } + } inferenceMap[this.inferences.indices[i]] = result.classifications[i].classes.sort((a, b) => b.score - a.score); } else { diff --git a/tensorboard/plugins/interactive_inference/utils/inference_utils.py b/tensorboard/plugins/interactive_inference/utils/inference_utils.py index 97d1dbace6..f5eece55ae 100644 --- a/tensorboard/plugins/interactive_inference/utils/inference_utils.py +++ b/tensorboard/plugins/interactive_inference/utils/inference_utils.py @@ -506,7 +506,11 @@ def make_json_formatted_for_single_chart(mutant_features, inference_result_proto.result.classifications) for mutant_feature, classification in zip( mutant_features, inference_result_proto.result.classifications): - for classification_class in classification.classes: + for class_index, classification_class in enumerate( + classification.classes): + # Fill in class index when labels are missing + if classification_class.label == '': + classification_class.label = str(class_index) # Special case to not include the "0" class in binary classification. # Since that just results in a chart that is symmetric around 0.5. if len(