MCPcopy Index your code
hub / github.com/tensorflow/tensorboard / run

Method run

tensorboard/plugins/hparams/download_data.py:59–159  ·  view source on GitHub ↗

Handles the request specified on construction. Returns: A response body. A mime type (string) for the response.

(self)

Source from the content-addressed store, hash-verified

57 self._columns_visibility = columns_visibility
58
59 def run(self):
60 """Handles the request specified on construction.
61
62 Returns:
63 A response body.
64 A mime type (string) for the response.
65 """
66 experiment = self._experiment
67 session_groups = self._session_groups
68 response_format = self._response_format
69 visibility = self._columns_visibility
70
71 header = []
72 for hparam_info in experiment.hparam_infos:
73 header.append(hparam_info.display_name or hparam_info.name)
74
75 for metric_info in experiment.metric_infos:
76 header.append(metric_info.display_name or metric_info.name.tag)
77
78 def _filter_columns(row):
79 return [value for value, visible in zip(row, visibility) if visible]
80
81 header = _filter_columns(header)
82
83 rows = []
84
85 def _get_value(value):
86 if value.HasField("number_value"):
87 return value.number_value
88 if value.HasField("string_value"):
89 return value.string_value
90 if value.HasField("bool_value"):
91 return value.bool_value
92 # hyperparameter values can be optional in a session group
93 return ""
94
95 def _get_metric_id(metric):
96 return metric.group + "." + metric.tag
97
98 for group in session_groups.session_groups:
99 row = []
100 for hparam_info in experiment.hparam_infos:
101 row.append(_get_value(group.hparams[hparam_info.name]))
102 metric_values = {}
103 for metric_value in group.metric_values:
104 metric_id = _get_metric_id(metric_value.name)
105 metric_values[metric_id] = metric_value.value
106 for metric_info in experiment.metric_infos:
107 metric_id = _get_metric_id(metric_info.name)
108 row.append(metric_values.get(metric_id))
109 rows.append(_filter_columns(row))
110
111 if response_format == OutputFormat.JSON:
112 mime_type = "application/json"
113 body = dict(header=header, rows=rows)
114 elif response_format == OutputFormat.LATEX:
115
116 def latex_format(value):

Callers 15

_run_handlerMethod · 0.95
_run_handlerMethod · 0.95
_run_handlerMethod · 0.95
setUpMethod · 0.45
mesh_demo.pyFile · 0.45
_create_dataMethod · 0.45
images_demo.pyFile · 0.45
generate_runMethod · 0.45
testSetLayoutMethod · 0.45
audio_demo.pyFile · 0.45
setUpMethod · 0.45

Calls 4

mapFunction · 0.85
getMethod · 0.65
appendMethod · 0.45
joinMethod · 0.45

Tested by 15

_run_handlerMethod · 0.76
_run_handlerMethod · 0.76
_run_handlerMethod · 0.76
setUpMethod · 0.36
_create_dataMethod · 0.36
generate_runMethod · 0.36
testSetLayoutMethod · 0.36
setUpMethod · 0.36
test_graph_modeMethod · 0.36
test_graph_modeMethod · 0.36
pb_via_opMethod · 0.36
test_matches_opMethod · 0.36