MCPcopy Create free account
hub / github.com/tensorflow/tensorboard / _index_impl

Method _index_impl

tensorboard/plugins/audio/audio_plugin.py:73–117  ·  view source on GitHub ↗

Return information about the tags in each run. Result is a dictionary of the form { "runName1": { "tagName1": { "displayName": "The first tag", "description": " Long ago there was just one tag... ",

(self, ctx, experiment)

Source from the content-addressed store, hash-verified

71 return base_plugin.FrontendMetadata(element_name="tf-audio-dashboard")
72
73 def _index_impl(self, ctx, experiment):
74 """Return information about the tags in each run.
75
76 Result is a dictionary of the form
77
78 {
79 "runName1": {
80 "tagName1": {
81 "displayName": "The first tag",
82 "description": "<p>Long ago there was just one tag...</p>",
83 "samples": 3
84 },
85 "tagName2": ...,
86 ...
87 },
88 "runName2": ...,
89 ...
90 }
91
92 For each tag, `samples` is the greatest number of audio clips that
93 appear at any particular step. (It&#x27;s not related to "samples of a
94 waveform.") For example, if for tag `minibatch_input` there are
95 five audio clips at step 0 and ten audio clips at step 1, then the
96 dictionary for `"minibatch_input"` will contain `"samples": 10`.
97 """
98 mapping = self._data_provider.list_blob_sequences(
99 ctx,
100 experiment_id=experiment,
101 plugin_name=metadata.PLUGIN_NAME,
102 )
103 result = {run: {} for run in mapping}
104 for run, tag_to_time_series in mapping.items():
105 for tag, time_series in tag_to_time_series.items():
106 md = metadata.parse_plugin_metadata(time_series.plugin_content)
107 if not self._version_checker.ok(md.version, run, tag):
108 continue
109 description = plugin_util.markdown_to_safe_html(
110 time_series.description
111 )
112 result[run][tag] = {
113 "displayName": time_series.display_name,
114 "description": description,
115 "samples": time_series.max_length,
116 }
117 return result
118
119 @wrappers.Request.application
120 def _serve_audio_metadata(self, request):

Callers 1

_serve_tagsMethod · 0.95

Calls 3

itemsMethod · 0.80
okMethod · 0.80
list_blob_sequencesMethod · 0.45

Tested by

no test coverage detected