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
|
@@ -0,0 +1,251 @@
|
|
|
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
|
+
"""Mesh summaries and TensorFlow operations to create them.
|
|
16
|
+
|
|
17
|
+
This file is deprecated. See `summary_v2.py` instead.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
import json
|
|
21
|
+
import tensorflow as tf
|
|
22
|
+
|
|
23
|
+
from tensorbored.plugins.mesh import metadata
|
|
24
|
+
from tensorbored.plugins.mesh import plugin_data_pb2
|
|
25
|
+
from tensorbored.plugins.mesh import summary_v2
|
|
26
|
+
|
|
27
|
+
# Export V2 versions.
|
|
28
|
+
mesh = summary_v2.mesh
|
|
29
|
+
mesh_pb = summary_v2.mesh_pb
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _get_tensor_summary(
|
|
33
|
+
name,
|
|
34
|
+
display_name,
|
|
35
|
+
description,
|
|
36
|
+
tensor,
|
|
37
|
+
content_type,
|
|
38
|
+
components,
|
|
39
|
+
json_config,
|
|
40
|
+
collections,
|
|
41
|
+
):
|
|
42
|
+
"""Creates a tensor summary with summary metadata.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
name: Uniquely identifiable name of the summary op. Could be replaced by
|
|
46
|
+
combination of name and type to make it unique even outside of this
|
|
47
|
+
summary.
|
|
48
|
+
display_name: Will be used as the display name in TensorBoard.
|
|
49
|
+
Defaults to `tag`.
|
|
50
|
+
description: A longform readable description of the summary data. Markdown
|
|
51
|
+
is supported.
|
|
52
|
+
tensor: Tensor to display in summary.
|
|
53
|
+
content_type: Type of content inside the Tensor.
|
|
54
|
+
components: Bitmask representing present parts (vertices, colors, etc.) that
|
|
55
|
+
belong to the summary.
|
|
56
|
+
json_config: A string, JSON-serialized dictionary of ThreeJS classes
|
|
57
|
+
configuration.
|
|
58
|
+
collections: List of collections to add this summary to.
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
Tensor summary with metadata.
|
|
62
|
+
"""
|
|
63
|
+
tensor = tf.convert_to_tensor(value=tensor)
|
|
64
|
+
shape = tensor.shape.as_list()
|
|
65
|
+
shape = [dim if dim is not None else -1 for dim in shape]
|
|
66
|
+
tensor_metadata = metadata.create_summary_metadata(
|
|
67
|
+
name,
|
|
68
|
+
display_name,
|
|
69
|
+
content_type,
|
|
70
|
+
components,
|
|
71
|
+
shape,
|
|
72
|
+
description,
|
|
73
|
+
json_config=json_config,
|
|
74
|
+
)
|
|
75
|
+
tensor_summary = tf.compat.v1.summary.tensor_summary(
|
|
76
|
+
metadata.get_instance_name(name, content_type),
|
|
77
|
+
tensor,
|
|
78
|
+
summary_metadata=tensor_metadata,
|
|
79
|
+
collections=collections,
|
|
80
|
+
)
|
|
81
|
+
return tensor_summary
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _get_display_name(name, display_name):
|
|
85
|
+
"""Returns display_name from display_name and name."""
|
|
86
|
+
if display_name is None:
|
|
87
|
+
return name
|
|
88
|
+
return display_name
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _get_json_config(config_dict):
|
|
92
|
+
"""Parses and returns JSON string from python dictionary."""
|
|
93
|
+
json_config = "{}"
|
|
94
|
+
if config_dict is not None:
|
|
95
|
+
json_config = json.dumps(config_dict, sort_keys=True)
|
|
96
|
+
return json_config
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def op(
|
|
100
|
+
name,
|
|
101
|
+
vertices,
|
|
102
|
+
faces=None,
|
|
103
|
+
colors=None,
|
|
104
|
+
display_name=None,
|
|
105
|
+
description=None,
|
|
106
|
+
collections=None,
|
|
107
|
+
config_dict=None,
|
|
108
|
+
):
|
|
109
|
+
"""Creates a TensorFlow summary op for mesh rendering.
|
|
110
|
+
|
|
111
|
+
DEPRECATED: see `summary_v2.py` instead.
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
name: A name for this summary operation.
|
|
115
|
+
vertices: Tensor of shape `[dim_1, ..., dim_n, 3]` representing the 3D
|
|
116
|
+
coordinates of vertices.
|
|
117
|
+
faces: Tensor of shape `[dim_1, ..., dim_n, 3]` containing indices of
|
|
118
|
+
vertices within each triangle.
|
|
119
|
+
colors: Tensor of shape `[dim_1, ..., dim_n, 3]` containing colors for each
|
|
120
|
+
vertex.
|
|
121
|
+
display_name: If set, will be used as the display name in TensorBoard.
|
|
122
|
+
Defaults to `name`.
|
|
123
|
+
description: A longform readable description of the summary data. Markdown
|
|
124
|
+
is supported.
|
|
125
|
+
collections: Which TensorFlow graph collections to add the summary op to.
|
|
126
|
+
Defaults to `['summaries']`. Can usually be ignored.
|
|
127
|
+
config_dict: Dictionary with ThreeJS classes names and configuration.
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
Merged summary for mesh/point cloud representation.
|
|
131
|
+
"""
|
|
132
|
+
display_name = _get_display_name(name, display_name)
|
|
133
|
+
json_config = _get_json_config(config_dict)
|
|
134
|
+
|
|
135
|
+
# All tensors representing a single mesh will be represented as separate
|
|
136
|
+
# summaries internally. Those summaries will be regrouped on the client before
|
|
137
|
+
# rendering.
|
|
138
|
+
summaries = []
|
|
139
|
+
tensors = [
|
|
140
|
+
metadata.MeshTensor(
|
|
141
|
+
vertices, plugin_data_pb2.MeshPluginData.VERTEX, tf.float32
|
|
142
|
+
),
|
|
143
|
+
metadata.MeshTensor(
|
|
144
|
+
faces, plugin_data_pb2.MeshPluginData.FACE, tf.int32
|
|
145
|
+
),
|
|
146
|
+
metadata.MeshTensor(
|
|
147
|
+
colors, plugin_data_pb2.MeshPluginData.COLOR, tf.uint8
|
|
148
|
+
),
|
|
149
|
+
]
|
|
150
|
+
tensors = [tensor for tensor in tensors if tensor.data is not None]
|
|
151
|
+
|
|
152
|
+
components = metadata.get_components_bitmask(
|
|
153
|
+
[tensor.content_type for tensor in tensors]
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
for tensor in tensors:
|
|
157
|
+
summaries.append(
|
|
158
|
+
_get_tensor_summary(
|
|
159
|
+
name,
|
|
160
|
+
display_name,
|
|
161
|
+
description,
|
|
162
|
+
tensor.data,
|
|
163
|
+
tensor.content_type,
|
|
164
|
+
components,
|
|
165
|
+
json_config,
|
|
166
|
+
collections,
|
|
167
|
+
)
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
all_summaries = tf.compat.v1.summary.merge(
|
|
171
|
+
summaries, collections=collections, name=name
|
|
172
|
+
)
|
|
173
|
+
return all_summaries
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def pb(
|
|
177
|
+
name,
|
|
178
|
+
vertices,
|
|
179
|
+
faces=None,
|
|
180
|
+
colors=None,
|
|
181
|
+
display_name=None,
|
|
182
|
+
description=None,
|
|
183
|
+
config_dict=None,
|
|
184
|
+
):
|
|
185
|
+
"""Create a mesh summary to save in pb format.
|
|
186
|
+
|
|
187
|
+
DEPRECATED: see `summary_v2.py` instead.
|
|
188
|
+
|
|
189
|
+
Args:
|
|
190
|
+
name: A name for this summary operation.
|
|
191
|
+
vertices: numpy array of shape `[dim_1, ..., dim_n, 3]` representing the 3D
|
|
192
|
+
coordinates of vertices.
|
|
193
|
+
faces: numpy array of shape `[dim_1, ..., dim_n, 3]` containing indices of
|
|
194
|
+
vertices within each triangle.
|
|
195
|
+
colors: numpy array of shape `[dim_1, ..., dim_n, 3]` containing colors for
|
|
196
|
+
each vertex.
|
|
197
|
+
display_name: If set, will be used as the display name in TensorBoard.
|
|
198
|
+
Defaults to `name`.
|
|
199
|
+
description: A longform readable description of the summary data. Markdown
|
|
200
|
+
is supported.
|
|
201
|
+
config_dict: Dictionary with ThreeJS classes names and configuration.
|
|
202
|
+
|
|
203
|
+
Returns:
|
|
204
|
+
Instance of tf.Summary class.
|
|
205
|
+
"""
|
|
206
|
+
display_name = _get_display_name(name, display_name)
|
|
207
|
+
json_config = _get_json_config(config_dict)
|
|
208
|
+
|
|
209
|
+
summaries = []
|
|
210
|
+
tensors = [
|
|
211
|
+
metadata.MeshTensor(
|
|
212
|
+
vertices, plugin_data_pb2.MeshPluginData.VERTEX, tf.float32
|
|
213
|
+
),
|
|
214
|
+
metadata.MeshTensor(
|
|
215
|
+
faces, plugin_data_pb2.MeshPluginData.FACE, tf.int32
|
|
216
|
+
),
|
|
217
|
+
metadata.MeshTensor(
|
|
218
|
+
colors, plugin_data_pb2.MeshPluginData.COLOR, tf.uint8
|
|
219
|
+
),
|
|
220
|
+
]
|
|
221
|
+
tensors = [tensor for tensor in tensors if tensor.data is not None]
|
|
222
|
+
components = metadata.get_components_bitmask(
|
|
223
|
+
[tensor.content_type for tensor in tensors]
|
|
224
|
+
)
|
|
225
|
+
for tensor in tensors:
|
|
226
|
+
shape = tensor.data.shape
|
|
227
|
+
shape = [dim if dim is not None else -1 for dim in shape]
|
|
228
|
+
tensor_proto = tf.compat.v1.make_tensor_proto(
|
|
229
|
+
tensor.data, dtype=tensor.data_type
|
|
230
|
+
)
|
|
231
|
+
summary_metadata = metadata.create_summary_metadata(
|
|
232
|
+
name,
|
|
233
|
+
display_name,
|
|
234
|
+
tensor.content_type,
|
|
235
|
+
components,
|
|
236
|
+
shape,
|
|
237
|
+
description,
|
|
238
|
+
json_config=json_config,
|
|
239
|
+
)
|
|
240
|
+
tag = metadata.get_instance_name(name, tensor.content_type)
|
|
241
|
+
summaries.append((tag, summary_metadata, tensor_proto))
|
|
242
|
+
|
|
243
|
+
summary = tf.compat.v1.Summary()
|
|
244
|
+
for tag, summary_metadata, tensor_proto in summaries:
|
|
245
|
+
tf_summary_metadata = tf.compat.v1.SummaryMetadata.FromString(
|
|
246
|
+
summary_metadata.SerializeToString()
|
|
247
|
+
)
|
|
248
|
+
summary.value.add(
|
|
249
|
+
tag=tag, metadata=tf_summary_metadata, tensor=tensor_proto
|
|
250
|
+
)
|
|
251
|
+
return summary
|
|
@@ -0,0 +1,214 @@
|
|
|
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
|
+
"""Mesh summaries and TensorFlow operations to create them.
|
|
16
|
+
|
|
17
|
+
V2 versions
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
import json
|
|
21
|
+
|
|
22
|
+
from tensorbored.compat import tf2 as tf
|
|
23
|
+
from tensorbored.compat.proto import summary_pb2
|
|
24
|
+
from tensorbored.plugins.mesh import metadata
|
|
25
|
+
from tensorbored.plugins.mesh import plugin_data_pb2
|
|
26
|
+
from tensorbored.util import tensor_util
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _write_summary(
|
|
30
|
+
name, description, tensor, content_type, components, json_config, step
|
|
31
|
+
):
|
|
32
|
+
"""Creates a tensor summary with summary metadata.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
name: A name for this summary. The summary tag used for TensorBoard will
|
|
36
|
+
be this name prefixed by any active name scopes.
|
|
37
|
+
description: Optional long-form description for this summary, as a
|
|
38
|
+
constant `str`. Markdown is supported. Defaults to empty.
|
|
39
|
+
tensor: Tensor to display in summary.
|
|
40
|
+
content_type: Type of content inside the Tensor.
|
|
41
|
+
components: Bitmask representing present parts (vertices, colors, etc.) that
|
|
42
|
+
belong to the summary.
|
|
43
|
+
json_config: A string, JSON-serialized dictionary of ThreeJS classes
|
|
44
|
+
configuration.
|
|
45
|
+
step: Explicit `int64`-castable monotonic step value for this summary. If
|
|
46
|
+
omitted, this defaults to `tf.summary.experimental.get_step()`, which must
|
|
47
|
+
not be None.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
A boolean indicating if summary was saved successfully or not.
|
|
51
|
+
"""
|
|
52
|
+
tensor = tf.convert_to_tensor(value=tensor)
|
|
53
|
+
shape = tensor.shape.as_list()
|
|
54
|
+
shape = [dim if dim is not None else -1 for dim in shape]
|
|
55
|
+
tensor_metadata = metadata.create_summary_metadata(
|
|
56
|
+
name,
|
|
57
|
+
None, # display_name
|
|
58
|
+
content_type,
|
|
59
|
+
components,
|
|
60
|
+
shape,
|
|
61
|
+
description,
|
|
62
|
+
json_config=json_config,
|
|
63
|
+
)
|
|
64
|
+
return tf.summary.write(
|
|
65
|
+
tag=metadata.get_instance_name(name, content_type),
|
|
66
|
+
tensor=tensor,
|
|
67
|
+
step=step,
|
|
68
|
+
metadata=tensor_metadata,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _get_json_config(config_dict):
|
|
73
|
+
"""Parses and returns JSON string from python dictionary."""
|
|
74
|
+
json_config = "{}"
|
|
75
|
+
if config_dict is not None:
|
|
76
|
+
json_config = json.dumps(config_dict, sort_keys=True)
|
|
77
|
+
return json_config
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def mesh(
|
|
81
|
+
name,
|
|
82
|
+
vertices,
|
|
83
|
+
faces=None,
|
|
84
|
+
colors=None,
|
|
85
|
+
config_dict=None,
|
|
86
|
+
step=None,
|
|
87
|
+
description=None,
|
|
88
|
+
):
|
|
89
|
+
"""Writes a TensorFlow mesh summary.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
name: A name for this summary. The summary tag used for TensorBoard will
|
|
93
|
+
be this name prefixed by any active name scopes.
|
|
94
|
+
vertices: Tensor of shape `[dim_1, ..., dim_n, 3]` representing the 3D
|
|
95
|
+
coordinates of vertices.
|
|
96
|
+
faces: Tensor of shape `[dim_1, ..., dim_n, 3]` containing indices of
|
|
97
|
+
vertices within each triangle.
|
|
98
|
+
colors: Tensor of shape `[dim_1, ..., dim_n, 3]` containing colors for each
|
|
99
|
+
vertex.
|
|
100
|
+
config_dict: Dictionary with ThreeJS classes names and configuration.
|
|
101
|
+
step: Explicit `int64`-castable monotonic step value for this summary. If
|
|
102
|
+
omitted, this defaults to `tf.summary.experimental.get_step()`, which must
|
|
103
|
+
not be None.
|
|
104
|
+
description: Optional long-form description for this summary, as a
|
|
105
|
+
constant `str`. Markdown is supported. Defaults to empty.
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
True if all components of the mesh were saved successfully and False
|
|
109
|
+
otherwise.
|
|
110
|
+
"""
|
|
111
|
+
json_config = _get_json_config(config_dict)
|
|
112
|
+
|
|
113
|
+
# All tensors representing a single mesh will be represented as separate
|
|
114
|
+
# summaries internally. Those summaries will be regrouped on the client before
|
|
115
|
+
# rendering.
|
|
116
|
+
tensors = [
|
|
117
|
+
metadata.MeshTensor(
|
|
118
|
+
vertices, plugin_data_pb2.MeshPluginData.VERTEX, tf.float32
|
|
119
|
+
),
|
|
120
|
+
metadata.MeshTensor(
|
|
121
|
+
faces, plugin_data_pb2.MeshPluginData.FACE, tf.int32
|
|
122
|
+
),
|
|
123
|
+
metadata.MeshTensor(
|
|
124
|
+
colors, plugin_data_pb2.MeshPluginData.COLOR, tf.uint8
|
|
125
|
+
),
|
|
126
|
+
]
|
|
127
|
+
tensors = [tensor for tensor in tensors if tensor.data is not None]
|
|
128
|
+
|
|
129
|
+
components = metadata.get_components_bitmask(
|
|
130
|
+
[tensor.content_type for tensor in tensors]
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
summary_scope = (
|
|
134
|
+
getattr(tf.summary.experimental, "summary_scope", None)
|
|
135
|
+
or tf.summary.summary_scope
|
|
136
|
+
)
|
|
137
|
+
all_success = True
|
|
138
|
+
with summary_scope(name, "mesh_summary", values=tensors):
|
|
139
|
+
for tensor in tensors:
|
|
140
|
+
all_success = all_success and _write_summary(
|
|
141
|
+
name,
|
|
142
|
+
description,
|
|
143
|
+
tensor.data,
|
|
144
|
+
tensor.content_type,
|
|
145
|
+
components,
|
|
146
|
+
json_config,
|
|
147
|
+
step,
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
return all_success
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def mesh_pb(
|
|
154
|
+
tag, vertices, faces=None, colors=None, config_dict=None, description=None
|
|
155
|
+
):
|
|
156
|
+
"""Create a mesh summary to save in pb format.
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
tag: String tag for the summary.
|
|
160
|
+
vertices: numpy array of shape `[dim_1, ..., dim_n, 3]` representing the 3D
|
|
161
|
+
coordinates of vertices.
|
|
162
|
+
faces: numpy array of shape `[dim_1, ..., dim_n, 3]` containing indices of
|
|
163
|
+
vertices within each triangle.
|
|
164
|
+
colors: numpy array of shape `[dim_1, ..., dim_n, 3]` containing colors for
|
|
165
|
+
each vertex.
|
|
166
|
+
config_dict: Dictionary with ThreeJS classes names and configuration.
|
|
167
|
+
description: Optional long-form description for this summary, as a
|
|
168
|
+
constant `str`. Markdown is supported. Defaults to empty.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
Instance of tf.Summary class.
|
|
172
|
+
"""
|
|
173
|
+
json_config = _get_json_config(config_dict)
|
|
174
|
+
|
|
175
|
+
summaries = []
|
|
176
|
+
tensors = [
|
|
177
|
+
metadata.MeshTensor(
|
|
178
|
+
vertices, plugin_data_pb2.MeshPluginData.VERTEX, tf.float32
|
|
179
|
+
),
|
|
180
|
+
metadata.MeshTensor(
|
|
181
|
+
faces, plugin_data_pb2.MeshPluginData.FACE, tf.int32
|
|
182
|
+
),
|
|
183
|
+
metadata.MeshTensor(
|
|
184
|
+
colors, plugin_data_pb2.MeshPluginData.COLOR, tf.uint8
|
|
185
|
+
),
|
|
186
|
+
]
|
|
187
|
+
tensors = [tensor for tensor in tensors if tensor.data is not None]
|
|
188
|
+
components = metadata.get_components_bitmask(
|
|
189
|
+
[tensor.content_type for tensor in tensors]
|
|
190
|
+
)
|
|
191
|
+
for tensor in tensors:
|
|
192
|
+
shape = tensor.data.shape
|
|
193
|
+
shape = [dim if dim is not None else -1 for dim in shape]
|
|
194
|
+
tensor_proto = tensor_util.make_tensor_proto(
|
|
195
|
+
tensor.data, dtype=tensor.data_type
|
|
196
|
+
)
|
|
197
|
+
summary_metadata = metadata.create_summary_metadata(
|
|
198
|
+
tag,
|
|
199
|
+
None, # display_name
|
|
200
|
+
tensor.content_type,
|
|
201
|
+
components,
|
|
202
|
+
shape,
|
|
203
|
+
description,
|
|
204
|
+
json_config=json_config,
|
|
205
|
+
)
|
|
206
|
+
instance_tag = metadata.get_instance_name(tag, tensor.content_type)
|
|
207
|
+
summaries.append((instance_tag, summary_metadata, tensor_proto))
|
|
208
|
+
|
|
209
|
+
summary = summary_pb2.Summary()
|
|
210
|
+
for instance_tag, summary_metadata, tensor_proto in summaries:
|
|
211
|
+
summary.value.add(
|
|
212
|
+
tag=instance_tag, metadata=summary_metadata, tensor=tensor_proto
|
|
213
|
+
)
|
|
214
|
+
return summary
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Copyright 2020 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
|
+
"""Internal information about the metrics plugin."""
|
|
16
|
+
|
|
17
|
+
PLUGIN_NAME = "timeseries"
|