tensorbored 2.21.0rc1769983804__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tensorbored/__init__.py +112 -0
- tensorbored/_vendor/__init__.py +0 -0
- tensorbored/_vendor/bleach/__init__.py +125 -0
- tensorbored/_vendor/bleach/_vendor/__init__.py +0 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/__init__.py +35 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/_ihatexml.py +289 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/_inputstream.py +918 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/_tokenizer.py +1735 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/_trie/__init__.py +5 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/_trie/_base.py +40 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/_trie/py.py +67 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/_utils.py +159 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/constants.py +2946 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/filters/__init__.py +0 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/filters/alphabeticalattributes.py +29 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/filters/base.py +12 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/filters/inject_meta_charset.py +73 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/filters/lint.py +93 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/filters/optionaltags.py +207 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/filters/sanitizer.py +916 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/filters/whitespace.py +38 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/html5parser.py +2795 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/serializer.py +409 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treeadapters/__init__.py +30 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treeadapters/genshi.py +54 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treeadapters/sax.py +50 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treebuilders/__init__.py +88 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treebuilders/base.py +417 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treebuilders/dom.py +239 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treebuilders/etree.py +343 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treebuilders/etree_lxml.py +392 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treewalkers/__init__.py +154 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treewalkers/base.py +252 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treewalkers/dom.py +43 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treewalkers/etree.py +131 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treewalkers/etree_lxml.py +215 -0
- tensorbored/_vendor/bleach/_vendor/html5lib/treewalkers/genshi.py +69 -0
- tensorbored/_vendor/bleach/_vendor/parse.py +1078 -0
- tensorbored/_vendor/bleach/callbacks.py +32 -0
- tensorbored/_vendor/bleach/html5lib_shim.py +757 -0
- tensorbored/_vendor/bleach/linkifier.py +633 -0
- tensorbored/_vendor/bleach/parse_shim.py +1 -0
- tensorbored/_vendor/bleach/sanitizer.py +638 -0
- tensorbored/_vendor/bleach/six_shim.py +19 -0
- tensorbored/_vendor/webencodings/__init__.py +342 -0
- tensorbored/_vendor/webencodings/labels.py +231 -0
- tensorbored/_vendor/webencodings/mklabels.py +59 -0
- tensorbored/_vendor/webencodings/x_user_defined.py +325 -0
- tensorbored/assets.py +36 -0
- tensorbored/auth.py +102 -0
- tensorbored/backend/__init__.py +0 -0
- tensorbored/backend/application.py +604 -0
- tensorbored/backend/auth_context_middleware.py +38 -0
- tensorbored/backend/client_feature_flags.py +113 -0
- tensorbored/backend/empty_path_redirect.py +46 -0
- tensorbored/backend/event_processing/__init__.py +0 -0
- tensorbored/backend/event_processing/data_ingester.py +276 -0
- tensorbored/backend/event_processing/data_provider.py +535 -0
- tensorbored/backend/event_processing/directory_loader.py +142 -0
- tensorbored/backend/event_processing/directory_watcher.py +272 -0
- tensorbored/backend/event_processing/event_accumulator.py +950 -0
- tensorbored/backend/event_processing/event_file_inspector.py +463 -0
- tensorbored/backend/event_processing/event_file_loader.py +292 -0
- tensorbored/backend/event_processing/event_multiplexer.py +521 -0
- tensorbored/backend/event_processing/event_util.py +68 -0
- tensorbored/backend/event_processing/io_wrapper.py +223 -0
- tensorbored/backend/event_processing/plugin_asset_util.py +104 -0
- tensorbored/backend/event_processing/plugin_event_accumulator.py +721 -0
- tensorbored/backend/event_processing/plugin_event_multiplexer.py +522 -0
- tensorbored/backend/event_processing/reservoir.py +266 -0
- tensorbored/backend/event_processing/tag_types.py +29 -0
- tensorbored/backend/experiment_id.py +71 -0
- tensorbored/backend/experimental_plugin.py +51 -0
- tensorbored/backend/http_util.py +263 -0
- tensorbored/backend/json_util.py +70 -0
- tensorbored/backend/path_prefix.py +67 -0
- tensorbored/backend/process_graph.py +74 -0
- tensorbored/backend/security_validator.py +202 -0
- tensorbored/compat/__init__.py +69 -0
- tensorbored/compat/proto/__init__.py +0 -0
- tensorbored/compat/proto/allocation_description_pb2.py +35 -0
- tensorbored/compat/proto/api_def_pb2.py +82 -0
- tensorbored/compat/proto/attr_value_pb2.py +80 -0
- tensorbored/compat/proto/cluster_pb2.py +58 -0
- tensorbored/compat/proto/config_pb2.py +271 -0
- tensorbored/compat/proto/coordination_config_pb2.py +45 -0
- tensorbored/compat/proto/cost_graph_pb2.py +87 -0
- tensorbored/compat/proto/cpp_shape_inference_pb2.py +70 -0
- tensorbored/compat/proto/debug_pb2.py +65 -0
- tensorbored/compat/proto/event_pb2.py +149 -0
- tensorbored/compat/proto/full_type_pb2.py +74 -0
- tensorbored/compat/proto/function_pb2.py +157 -0
- tensorbored/compat/proto/graph_debug_info_pb2.py +111 -0
- tensorbored/compat/proto/graph_pb2.py +41 -0
- tensorbored/compat/proto/histogram_pb2.py +39 -0
- tensorbored/compat/proto/meta_graph_pb2.py +254 -0
- tensorbored/compat/proto/node_def_pb2.py +61 -0
- tensorbored/compat/proto/op_def_pb2.py +81 -0
- tensorbored/compat/proto/resource_handle_pb2.py +48 -0
- tensorbored/compat/proto/rewriter_config_pb2.py +93 -0
- tensorbored/compat/proto/rpc_options_pb2.py +35 -0
- tensorbored/compat/proto/saved_object_graph_pb2.py +193 -0
- tensorbored/compat/proto/saver_pb2.py +38 -0
- tensorbored/compat/proto/step_stats_pb2.py +116 -0
- tensorbored/compat/proto/struct_pb2.py +144 -0
- tensorbored/compat/proto/summary_pb2.py +111 -0
- tensorbored/compat/proto/tensor_description_pb2.py +38 -0
- tensorbored/compat/proto/tensor_pb2.py +68 -0
- tensorbored/compat/proto/tensor_shape_pb2.py +46 -0
- tensorbored/compat/proto/tfprof_log_pb2.py +307 -0
- tensorbored/compat/proto/trackable_object_graph_pb2.py +90 -0
- tensorbored/compat/proto/types_pb2.py +105 -0
- tensorbored/compat/proto/variable_pb2.py +62 -0
- tensorbored/compat/proto/verifier_config_pb2.py +38 -0
- tensorbored/compat/proto/versions_pb2.py +35 -0
- tensorbored/compat/tensorflow_stub/__init__.py +38 -0
- tensorbored/compat/tensorflow_stub/app.py +124 -0
- tensorbored/compat/tensorflow_stub/compat/__init__.py +131 -0
- tensorbored/compat/tensorflow_stub/compat/v1/__init__.py +20 -0
- tensorbored/compat/tensorflow_stub/dtypes.py +692 -0
- tensorbored/compat/tensorflow_stub/error_codes.py +169 -0
- tensorbored/compat/tensorflow_stub/errors.py +507 -0
- tensorbored/compat/tensorflow_stub/flags.py +124 -0
- tensorbored/compat/tensorflow_stub/io/__init__.py +17 -0
- tensorbored/compat/tensorflow_stub/io/gfile.py +1011 -0
- tensorbored/compat/tensorflow_stub/pywrap_tensorflow.py +285 -0
- tensorbored/compat/tensorflow_stub/tensor_shape.py +1035 -0
- tensorbored/context.py +129 -0
- tensorbored/data/__init__.py +0 -0
- tensorbored/data/grpc_provider.py +365 -0
- tensorbored/data/ingester.py +46 -0
- tensorbored/data/proto/__init__.py +0 -0
- tensorbored/data/proto/data_provider_pb2.py +517 -0
- tensorbored/data/proto/data_provider_pb2_grpc.py +374 -0
- tensorbored/data/provider.py +1365 -0
- tensorbored/data/server_ingester.py +301 -0
- tensorbored/data_compat.py +159 -0
- tensorbored/dataclass_compat.py +224 -0
- tensorbored/default.py +124 -0
- tensorbored/errors.py +130 -0
- tensorbored/lazy.py +99 -0
- tensorbored/main.py +48 -0
- tensorbored/main_lib.py +62 -0
- tensorbored/manager.py +487 -0
- tensorbored/notebook.py +441 -0
- tensorbored/plugin_util.py +266 -0
- tensorbored/plugins/__init__.py +0 -0
- tensorbored/plugins/audio/__init__.py +0 -0
- tensorbored/plugins/audio/audio_plugin.py +229 -0
- tensorbored/plugins/audio/metadata.py +69 -0
- tensorbored/plugins/audio/plugin_data_pb2.py +37 -0
- tensorbored/plugins/audio/summary.py +230 -0
- tensorbored/plugins/audio/summary_v2.py +124 -0
- tensorbored/plugins/base_plugin.py +367 -0
- tensorbored/plugins/core/__init__.py +0 -0
- tensorbored/plugins/core/core_plugin.py +981 -0
- tensorbored/plugins/custom_scalar/__init__.py +0 -0
- tensorbored/plugins/custom_scalar/custom_scalars_plugin.py +320 -0
- tensorbored/plugins/custom_scalar/layout_pb2.py +85 -0
- tensorbored/plugins/custom_scalar/metadata.py +35 -0
- tensorbored/plugins/custom_scalar/summary.py +79 -0
- tensorbored/plugins/debugger_v2/__init__.py +0 -0
- tensorbored/plugins/debugger_v2/debug_data_multiplexer.py +631 -0
- tensorbored/plugins/debugger_v2/debug_data_provider.py +634 -0
- tensorbored/plugins/debugger_v2/debugger_v2_plugin.py +504 -0
- tensorbored/plugins/distribution/__init__.py +0 -0
- tensorbored/plugins/distribution/compressor.py +158 -0
- tensorbored/plugins/distribution/distributions_plugin.py +116 -0
- tensorbored/plugins/distribution/metadata.py +19 -0
- tensorbored/plugins/graph/__init__.py +0 -0
- tensorbored/plugins/graph/graph_util.py +129 -0
- tensorbored/plugins/graph/graphs_plugin.py +336 -0
- tensorbored/plugins/graph/keras_util.py +328 -0
- tensorbored/plugins/graph/metadata.py +42 -0
- tensorbored/plugins/histogram/__init__.py +0 -0
- tensorbored/plugins/histogram/histograms_plugin.py +144 -0
- tensorbored/plugins/histogram/metadata.py +63 -0
- tensorbored/plugins/histogram/plugin_data_pb2.py +34 -0
- tensorbored/plugins/histogram/summary.py +234 -0
- tensorbored/plugins/histogram/summary_v2.py +292 -0
- tensorbored/plugins/hparams/__init__.py +14 -0
- tensorbored/plugins/hparams/_keras.py +93 -0
- tensorbored/plugins/hparams/api.py +130 -0
- tensorbored/plugins/hparams/api_pb2.py +208 -0
- tensorbored/plugins/hparams/backend_context.py +606 -0
- tensorbored/plugins/hparams/download_data.py +158 -0
- tensorbored/plugins/hparams/error.py +26 -0
- tensorbored/plugins/hparams/get_experiment.py +71 -0
- tensorbored/plugins/hparams/hparams_plugin.py +206 -0
- tensorbored/plugins/hparams/hparams_util_pb2.py +69 -0
- tensorbored/plugins/hparams/json_format_compat.py +38 -0
- tensorbored/plugins/hparams/list_metric_evals.py +57 -0
- tensorbored/plugins/hparams/list_session_groups.py +1040 -0
- tensorbored/plugins/hparams/metadata.py +125 -0
- tensorbored/plugins/hparams/metrics.py +41 -0
- tensorbored/plugins/hparams/plugin_data_pb2.py +69 -0
- tensorbored/plugins/hparams/summary.py +205 -0
- tensorbored/plugins/hparams/summary_v2.py +597 -0
- tensorbored/plugins/image/__init__.py +0 -0
- tensorbored/plugins/image/images_plugin.py +232 -0
- tensorbored/plugins/image/metadata.py +65 -0
- tensorbored/plugins/image/plugin_data_pb2.py +34 -0
- tensorbored/plugins/image/summary.py +159 -0
- tensorbored/plugins/image/summary_v2.py +130 -0
- tensorbored/plugins/mesh/__init__.py +14 -0
- tensorbored/plugins/mesh/mesh_plugin.py +292 -0
- tensorbored/plugins/mesh/metadata.py +152 -0
- tensorbored/plugins/mesh/plugin_data_pb2.py +37 -0
- tensorbored/plugins/mesh/summary.py +251 -0
- tensorbored/plugins/mesh/summary_v2.py +214 -0
- tensorbored/plugins/metrics/__init__.py +0 -0
- tensorbored/plugins/metrics/metadata.py +17 -0
- tensorbored/plugins/metrics/metrics_plugin.py +623 -0
- tensorbored/plugins/pr_curve/__init__.py +0 -0
- tensorbored/plugins/pr_curve/metadata.py +75 -0
- tensorbored/plugins/pr_curve/plugin_data_pb2.py +34 -0
- tensorbored/plugins/pr_curve/pr_curves_plugin.py +241 -0
- tensorbored/plugins/pr_curve/summary.py +574 -0
- tensorbored/plugins/profile_redirect/__init__.py +0 -0
- tensorbored/plugins/profile_redirect/profile_redirect_plugin.py +49 -0
- tensorbored/plugins/projector/__init__.py +67 -0
- tensorbored/plugins/projector/metadata.py +26 -0
- tensorbored/plugins/projector/projector_config_pb2.py +54 -0
- tensorbored/plugins/projector/projector_plugin.py +795 -0
- tensorbored/plugins/projector/tf_projector_plugin/index.js +32 -0
- tensorbored/plugins/projector/tf_projector_plugin/projector_binary.html +524 -0
- tensorbored/plugins/projector/tf_projector_plugin/projector_binary.js +15536 -0
- tensorbored/plugins/scalar/__init__.py +0 -0
- tensorbored/plugins/scalar/metadata.py +60 -0
- tensorbored/plugins/scalar/plugin_data_pb2.py +34 -0
- tensorbored/plugins/scalar/scalars_plugin.py +181 -0
- tensorbored/plugins/scalar/summary.py +109 -0
- tensorbored/plugins/scalar/summary_v2.py +124 -0
- tensorbored/plugins/text/__init__.py +0 -0
- tensorbored/plugins/text/metadata.py +62 -0
- tensorbored/plugins/text/plugin_data_pb2.py +34 -0
- tensorbored/plugins/text/summary.py +114 -0
- tensorbored/plugins/text/summary_v2.py +124 -0
- tensorbored/plugins/text/text_plugin.py +288 -0
- tensorbored/plugins/wit_redirect/__init__.py +0 -0
- tensorbored/plugins/wit_redirect/wit_redirect_plugin.py +49 -0
- tensorbored/program.py +910 -0
- tensorbored/summary/__init__.py +35 -0
- tensorbored/summary/_output.py +124 -0
- tensorbored/summary/_tf/__init__.py +14 -0
- tensorbored/summary/_tf/summary/__init__.py +178 -0
- tensorbored/summary/_writer.py +105 -0
- tensorbored/summary/v1.py +51 -0
- tensorbored/summary/v2.py +25 -0
- tensorbored/summary/writer/__init__.py +13 -0
- tensorbored/summary/writer/event_file_writer.py +291 -0
- tensorbored/summary/writer/record_writer.py +50 -0
- tensorbored/util/__init__.py +0 -0
- tensorbored/util/encoder.py +116 -0
- tensorbored/util/grpc_util.py +311 -0
- tensorbored/util/img_mime_type_detector.py +40 -0
- tensorbored/util/io_util.py +20 -0
- tensorbored/util/lazy_tensor_creator.py +110 -0
- tensorbored/util/op_evaluator.py +104 -0
- tensorbored/util/platform_util.py +20 -0
- tensorbored/util/tb_logging.py +24 -0
- tensorbored/util/tensor_util.py +617 -0
- tensorbored/util/timing.py +122 -0
- tensorbored/version.py +21 -0
- tensorbored/webfiles.zip +0 -0
- tensorbored-2.21.0rc1769983804.dist-info/METADATA +49 -0
- tensorbored-2.21.0rc1769983804.dist-info/RECORD +271 -0
- tensorbored-2.21.0rc1769983804.dist-info/WHEEL +5 -0
- tensorbored-2.21.0rc1769983804.dist-info/entry_points.txt +6 -0
- tensorbored-2.21.0rc1769983804.dist-info/licenses/LICENSE +739 -0
- tensorbored-2.21.0rc1769983804.dist-info/top_level.txt +1 -0
tensorbored/default.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
"""Collection of first-party plugins.
|
|
16
|
+
|
|
17
|
+
This module exists to isolate tensorboard.program from the potentially
|
|
18
|
+
heavyweight build dependencies for first-party plugins. This way people
|
|
19
|
+
doing custom builds of TensorBoard have the option to only pay for the
|
|
20
|
+
dependencies they want.
|
|
21
|
+
|
|
22
|
+
This module also grants the flexibility to those doing custom builds, to
|
|
23
|
+
automatically inherit the centrally-maintained list of standard plugins,
|
|
24
|
+
for less repetition.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
import logging
|
|
28
|
+
|
|
29
|
+
import pkg_resources
|
|
30
|
+
|
|
31
|
+
from tensorbored.plugins.audio import audio_plugin
|
|
32
|
+
from tensorbored.plugins.core import core_plugin
|
|
33
|
+
from tensorbored.plugins.custom_scalar import custom_scalars_plugin
|
|
34
|
+
from tensorbored.plugins.debugger_v2 import debugger_v2_plugin
|
|
35
|
+
from tensorbored.plugins.distribution import distributions_plugin
|
|
36
|
+
from tensorbored.plugins.graph import graphs_plugin
|
|
37
|
+
from tensorbored.plugins.histogram import histograms_plugin
|
|
38
|
+
from tensorbored.plugins.hparams import hparams_plugin
|
|
39
|
+
from tensorbored.plugins.image import images_plugin
|
|
40
|
+
from tensorbored.plugins.metrics import metrics_plugin
|
|
41
|
+
from tensorbored.plugins.pr_curve import pr_curves_plugin
|
|
42
|
+
from tensorbored.plugins.profile_redirect import profile_redirect_plugin
|
|
43
|
+
from tensorbored.plugins.scalar import scalars_plugin
|
|
44
|
+
from tensorbored.plugins.text import text_plugin
|
|
45
|
+
from tensorbored.plugins.mesh import mesh_plugin
|
|
46
|
+
from tensorbored.plugins.wit_redirect import wit_redirect_plugin
|
|
47
|
+
|
|
48
|
+
logger = logging.getLogger(__name__)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Ordering matters. The order in which these lines appear determines the
|
|
52
|
+
# ordering of tabs in TensorBoard's GUI.
|
|
53
|
+
_PLUGINS = [
|
|
54
|
+
core_plugin.CorePluginLoader(include_debug_info=True),
|
|
55
|
+
metrics_plugin.MetricsPlugin,
|
|
56
|
+
scalars_plugin.ScalarsPlugin,
|
|
57
|
+
custom_scalars_plugin.CustomScalarsPlugin,
|
|
58
|
+
images_plugin.ImagesPlugin,
|
|
59
|
+
audio_plugin.AudioPlugin,
|
|
60
|
+
debugger_v2_plugin.DebuggerV2Plugin,
|
|
61
|
+
graphs_plugin.GraphsPlugin,
|
|
62
|
+
distributions_plugin.DistributionsPlugin,
|
|
63
|
+
histograms_plugin.HistogramsPlugin,
|
|
64
|
+
text_plugin.TextPlugin,
|
|
65
|
+
pr_curves_plugin.PrCurvesPlugin,
|
|
66
|
+
profile_redirect_plugin.ProfileRedirectPluginLoader,
|
|
67
|
+
hparams_plugin.HParamsPlugin,
|
|
68
|
+
mesh_plugin.MeshPlugin,
|
|
69
|
+
wit_redirect_plugin.WITRedirectPluginLoader,
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def get_plugins():
|
|
74
|
+
"""Returns a list specifying all known TensorBoard plugins.
|
|
75
|
+
|
|
76
|
+
This includes both first-party, statically bundled plugins and
|
|
77
|
+
dynamic plugins.
|
|
78
|
+
|
|
79
|
+
This list can be passed to the `tensorboard.program.TensorBoard` API.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
The list of default first-party plugins.
|
|
83
|
+
"""
|
|
84
|
+
return get_static_plugins() + get_dynamic_plugins()
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def get_static_plugins():
|
|
88
|
+
"""Returns a list specifying TensorBoard's default first-party plugins.
|
|
89
|
+
|
|
90
|
+
Plugins are specified in this list either via a TBLoader instance to load the
|
|
91
|
+
plugin, or the TBPlugin class itself which will be loaded using a BasicLoader.
|
|
92
|
+
|
|
93
|
+
This list can be passed to the `tensorboard.program.TensorBoard` API.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
The list of default first-party plugins.
|
|
97
|
+
|
|
98
|
+
:rtype: list[Type[base_plugin.TBLoader] | Type[base_plugin.TBPlugin]]
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
return _PLUGINS[:]
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def get_dynamic_plugins():
|
|
105
|
+
"""Returns a list specifying TensorBoard's dynamically loaded plugins.
|
|
106
|
+
|
|
107
|
+
A dynamic TensorBoard plugin is specified using entry_points [1] and it is
|
|
108
|
+
the robust way to integrate plugins into TensorBoard.
|
|
109
|
+
|
|
110
|
+
This list can be passed to the `tensorboard.program.TensorBoard` API.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
The list of dynamic plugins.
|
|
114
|
+
|
|
115
|
+
:rtype: list[Type[base_plugin.TBLoader] | Type[base_plugin.TBPlugin]]
|
|
116
|
+
|
|
117
|
+
[1]: https://packaging.python.org/specifications/entry-points/
|
|
118
|
+
"""
|
|
119
|
+
return [
|
|
120
|
+
entry_point.resolve()
|
|
121
|
+
for entry_point in pkg_resources.iter_entry_points(
|
|
122
|
+
"tensorbored_plugins"
|
|
123
|
+
)
|
|
124
|
+
]
|
tensorbored/errors.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
"""Error codes (experimental module).
|
|
16
|
+
|
|
17
|
+
These types represent a subset of the Google error codes [1], which are
|
|
18
|
+
also used by TensorFlow, gRPC, et al.
|
|
19
|
+
|
|
20
|
+
When an HTTP handler raises one of these errors, the TensorBoard core
|
|
21
|
+
application will catch it and automatically serve a properly formatted
|
|
22
|
+
response with the error message.
|
|
23
|
+
|
|
24
|
+
[1]: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class PublicError(RuntimeError):
|
|
29
|
+
"""An error whose text does not contain sensitive information.
|
|
30
|
+
|
|
31
|
+
Fields:
|
|
32
|
+
http_code: Integer between 400 and 599 inclusive (e.g., 404).
|
|
33
|
+
headers: List of additional key-value pairs to include in the
|
|
34
|
+
response body, like `[("Allow", "GET")]` for HTTP 405 or
|
|
35
|
+
`[("WWW-Authenticate", "Digest")]` for HTTP 401. May be empty.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
http_code = 500 # default; subclasses should override
|
|
39
|
+
|
|
40
|
+
def __init__(self, details):
|
|
41
|
+
super().__init__(details)
|
|
42
|
+
self.headers = []
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class InvalidArgumentError(PublicError):
|
|
46
|
+
"""Client specified an invalid argument.
|
|
47
|
+
|
|
48
|
+
The text of this error is assumed not to contain sensitive data,
|
|
49
|
+
and so may appear in (e.g.) the response body of a failed HTTP
|
|
50
|
+
request.
|
|
51
|
+
|
|
52
|
+
Corresponds to HTTP 400 Bad Request or Google error code `INVALID_ARGUMENT`.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
http_code = 400
|
|
56
|
+
|
|
57
|
+
def __init__(self, details=None):
|
|
58
|
+
msg = _format_message("Invalid argument", details)
|
|
59
|
+
super().__init__(msg)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class NotFoundError(PublicError):
|
|
63
|
+
"""Some requested entity (e.g., file or directory) was not found.
|
|
64
|
+
|
|
65
|
+
The text of this error is assumed not to contain sensitive data,
|
|
66
|
+
and so may appear in (e.g.) the response body of a failed HTTP
|
|
67
|
+
request.
|
|
68
|
+
|
|
69
|
+
Corresponds to HTTP 404 Not Found or Google error code `NOT_FOUND`.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
http_code = 404
|
|
73
|
+
|
|
74
|
+
def __init__(self, details=None):
|
|
75
|
+
msg = _format_message("Not found", details)
|
|
76
|
+
super().__init__(msg)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class UnauthenticatedError(PublicError):
|
|
80
|
+
"""Request does not have valid authentication credentials for the operation.
|
|
81
|
+
|
|
82
|
+
The text of this error is assumed not to contain sensitive data,
|
|
83
|
+
and so may appear in (e.g.) the response body of a failed HTTP
|
|
84
|
+
request.
|
|
85
|
+
|
|
86
|
+
Corresponds to HTTP 401 Unauthorized (despite the name) or Google
|
|
87
|
+
error code `UNAUTHENTICATED`. HTTP 401 responses are required to
|
|
88
|
+
contain a `WWW-Authenticate` challenge, so `UnauthenticatedError`
|
|
89
|
+
values are, too.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
http_code = 401
|
|
93
|
+
|
|
94
|
+
def __init__(self, details=None, *, challenge):
|
|
95
|
+
"""Initialize an `UnauthenticatedError`.
|
|
96
|
+
|
|
97
|
+
Args;
|
|
98
|
+
details: Optional public, user-facing error message, as a
|
|
99
|
+
string or any value that can be converted to string, or
|
|
100
|
+
`None` to omit details.
|
|
101
|
+
challenge: String value of the `WWW-Authenticate` HTTP header
|
|
102
|
+
as described in RFC 7235.
|
|
103
|
+
"""
|
|
104
|
+
msg = _format_message("Unauthenticated", details)
|
|
105
|
+
super().__init__(msg)
|
|
106
|
+
self.headers.append(("WWW-Authenticate", challenge))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class PermissionDeniedError(PublicError):
|
|
110
|
+
"""The caller does not have permission to execute the specified operation.
|
|
111
|
+
|
|
112
|
+
The text of this error is assumed not to contain sensitive data,
|
|
113
|
+
and so may appear in (e.g.) the response body of a failed HTTP
|
|
114
|
+
request.
|
|
115
|
+
|
|
116
|
+
Corresponds to HTTP 403 Forbidden or Google error code `PERMISSION_DENIED`.
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
http_code = 403
|
|
120
|
+
|
|
121
|
+
def __init__(self, details=None):
|
|
122
|
+
msg = _format_message("Permission denied", details)
|
|
123
|
+
super().__init__(msg)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _format_message(code_name, details):
|
|
127
|
+
if details is None:
|
|
128
|
+
return code_name
|
|
129
|
+
else:
|
|
130
|
+
return "%s: %s" % (code_name, details)
|
tensorbored/lazy.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
"""TensorBoard is a webapp for understanding TensorFlow runs and graphs."""
|
|
16
|
+
|
|
17
|
+
import functools
|
|
18
|
+
import threading
|
|
19
|
+
import types
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def lazy_load(name):
|
|
23
|
+
"""Decorator to define a function that lazily loads the module 'name'.
|
|
24
|
+
|
|
25
|
+
This can be used to defer importing troublesome dependencies - e.g. ones that
|
|
26
|
+
are large and infrequently used, or that cause a dependency cycle -
|
|
27
|
+
until they are actually used.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
name: the fully-qualified name of the module; typically the last segment
|
|
31
|
+
of 'name' matches the name of the decorated function
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
Decorator function that produces a lazy-loading module 'name' backed by the
|
|
35
|
+
underlying decorated function.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def wrapper(load_fn):
|
|
39
|
+
# Wrap load_fn to call it exactly once and update __dict__ afterwards to
|
|
40
|
+
# make future lookups efficient (only failed lookups call __getattr__).
|
|
41
|
+
@_memoize
|
|
42
|
+
def load_once(self):
|
|
43
|
+
if load_once.loading:
|
|
44
|
+
raise ImportError(
|
|
45
|
+
"Circular import when resolving LazyModule %r" % name
|
|
46
|
+
)
|
|
47
|
+
load_once.loading = True
|
|
48
|
+
try:
|
|
49
|
+
module = load_fn()
|
|
50
|
+
finally:
|
|
51
|
+
load_once.loading = False
|
|
52
|
+
self.__dict__.update(module.__dict__)
|
|
53
|
+
load_once.loaded = True
|
|
54
|
+
return module
|
|
55
|
+
|
|
56
|
+
load_once.loading = False
|
|
57
|
+
load_once.loaded = False
|
|
58
|
+
|
|
59
|
+
# Define a module that proxies getattr() and dir() to the result of calling
|
|
60
|
+
# load_once() the first time it's needed. The class is nested so we can close
|
|
61
|
+
# over load_once() and avoid polluting the module's attrs with our own state.
|
|
62
|
+
class LazyModule(types.ModuleType):
|
|
63
|
+
def __getattr__(self, attr_name):
|
|
64
|
+
return getattr(load_once(self), attr_name)
|
|
65
|
+
|
|
66
|
+
def __dir__(self):
|
|
67
|
+
return dir(load_once(self))
|
|
68
|
+
|
|
69
|
+
def __repr__(self):
|
|
70
|
+
if load_once.loaded:
|
|
71
|
+
return "<%r via LazyModule (loaded)>" % load_once(self)
|
|
72
|
+
return (
|
|
73
|
+
"<module %r via LazyModule (not yet loaded)>"
|
|
74
|
+
% self.__name__
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
return LazyModule(name)
|
|
78
|
+
|
|
79
|
+
return wrapper
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _memoize(f):
|
|
83
|
+
"""Memoizing decorator for f, which must have exactly 1 hashable
|
|
84
|
+
argument."""
|
|
85
|
+
nothing = object() # Unique "no value" sentinel object.
|
|
86
|
+
cache = {}
|
|
87
|
+
# Use a reentrant lock so that if f references the resulting wrapper we die
|
|
88
|
+
# with recursion depth exceeded instead of deadlocking.
|
|
89
|
+
lock = threading.RLock()
|
|
90
|
+
|
|
91
|
+
@functools.wraps(f)
|
|
92
|
+
def wrapper(arg):
|
|
93
|
+
if cache.get(arg, nothing) is nothing:
|
|
94
|
+
with lock:
|
|
95
|
+
if cache.get(arg, nothing) is nothing:
|
|
96
|
+
cache[arg] = f(arg)
|
|
97
|
+
return cache[arg]
|
|
98
|
+
|
|
99
|
+
return wrapper
|
tensorbored/main.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
"""TensorBoard main module.
|
|
16
|
+
|
|
17
|
+
This module ties together `tensorboard.program` and
|
|
18
|
+
`tensorboard.default_plugins` to provide standard TensorBoard. It's
|
|
19
|
+
meant to be tiny and act as little other than a config file. Those
|
|
20
|
+
wishing to customize the set of plugins or static assets that
|
|
21
|
+
TensorBoard uses can swap out this file with their own.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
import sys
|
|
25
|
+
|
|
26
|
+
from absl import app
|
|
27
|
+
from tensorbored import default
|
|
28
|
+
from tensorbored import main_lib
|
|
29
|
+
from tensorbored import program
|
|
30
|
+
from tensorbored.plugins import base_plugin
|
|
31
|
+
from tensorbored.util import tb_logging
|
|
32
|
+
|
|
33
|
+
logger = tb_logging.get_logger()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def run_main():
|
|
37
|
+
"""Initializes flags and calls main()."""
|
|
38
|
+
main_lib.global_init()
|
|
39
|
+
tensorboard = program.TensorBoard(plugins=default.get_plugins())
|
|
40
|
+
try:
|
|
41
|
+
app.run(tensorboard.main, flags_parser=tensorboard.configure)
|
|
42
|
+
except base_plugin.FlagsError as e:
|
|
43
|
+
print("Error: %s" % e, file=sys.stderr)
|
|
44
|
+
sys.exit(1)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
run_main()
|
tensorbored/main_lib.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
"""Helpers for TensorBoard main module."""
|
|
16
|
+
|
|
17
|
+
import os
|
|
18
|
+
import sys
|
|
19
|
+
|
|
20
|
+
import absl.logging
|
|
21
|
+
|
|
22
|
+
from tensorbored.compat import tf
|
|
23
|
+
|
|
24
|
+
_TBDEV_SHUTDOWN_MESSAGE = """\
|
|
25
|
+
======================================================================
|
|
26
|
+
ERROR: The `tensorboard dev` command is no longer available.
|
|
27
|
+
|
|
28
|
+
TensorBoard.dev has been shut down. For further information,
|
|
29
|
+
see the FAQ at <https://tensorbored.dev/>.
|
|
30
|
+
======================================================================
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def global_init():
|
|
35
|
+
"""Modifies the global environment for running TensorBoard as main.
|
|
36
|
+
|
|
37
|
+
This functions changes global state in the Python process, so it should
|
|
38
|
+
not be called from library routines.
|
|
39
|
+
"""
|
|
40
|
+
# TF versions prior to 1.15.0 included default GCS filesystem caching logic
|
|
41
|
+
# that interacted pathologically with the pattern of reads used by TensorBoard
|
|
42
|
+
# for logdirs. See: https://github.com/tensorflow/tensorboard/issues/1225
|
|
43
|
+
# The problematic behavior was fixed in 1.15.0 by
|
|
44
|
+
# https://github.com/tensorflow/tensorflow/commit/e43b94649d3e1ac5d538e4eca9166b899511d681
|
|
45
|
+
# but for older versions of TF, we avoid a regression by setting this env var to
|
|
46
|
+
# disable the cache, which must be done before the first import of tensorflow.
|
|
47
|
+
os.environ["GCS_READ_CACHE_DISABLED"] = "1"
|
|
48
|
+
|
|
49
|
+
if getattr(tf, "__version__", "stub") == "stub":
|
|
50
|
+
print(
|
|
51
|
+
"TensorFlow installation not found - running with reduced feature set.",
|
|
52
|
+
file=sys.stderr,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# Only emit log messages at WARNING and above by default to reduce spam.
|
|
56
|
+
absl.logging.set_verbosity(absl.logging.WARNING)
|
|
57
|
+
|
|
58
|
+
# Intercept attempts to invoke `tensorboard dev` and print turndown message.
|
|
59
|
+
if sys.argv[1:] and sys.argv[1] == "dev":
|
|
60
|
+
sys.stderr.write(_TBDEV_SHUTDOWN_MESSAGE)
|
|
61
|
+
sys.stderr.flush()
|
|
62
|
+
sys.exit(1)
|