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

Function session_start_pb

tensorboard/plugins/hparams/summary.py:79–149  ·  view source on GitHub ↗

Constructs a SessionStartInfo protobuffer. Creates a summary that contains a training session metadata information. One such summary per training session should be created. Each should have a different run. Args: hparams: A dictionary with string keys. Describes the hyperpara

(
    hparams, model_uri="", monitor_url="", group_name="", start_time_secs=None
)

Source from the content-addressed store, hash-verified

77
78
79def session_start_pb(
80 hparams, model_uri="", monitor_url="", group_name="", start_time_secs=None
81):
82 """Constructs a SessionStartInfo protobuffer.
83
84 Creates a summary that contains a training session metadata information.
85 One such summary per training session should be created. Each should have
86 a different run.
87
88 Args:
89 hparams: A dictionary with string keys. Describes the hyperparameter values
90 used in the session, mapping each hyperparameter name to its value.
91 Supported value types are `bool`, `int`, `float`, `str`, `list`,
92 `tuple`.
93 The type of value must correspond to the type of hyperparameter
94 (defined in the corresponding api_pb2.HParamInfo member of the
95 Experiment protobuf) as follows:
96
97 +-----------------+---------------------------------+
98 |Hyperparameter | Allowed (Python) value types |
99 |type | |
100 +-----------------+---------------------------------+
101 |DATA_TYPE_BOOL | bool |
102 |DATA_TYPE_FLOAT64| int, float |
103 |DATA_TYPE_STRING | str, tuple, list |
104 +-----------------+---------------------------------+
105
106 Tuple and list instances will be converted to their string
107 representation.
108 model_uri: See the comment for the field with the same name of
109 plugin_data_pb2.SessionStartInfo.
110 monitor_url: See the comment for the field with the same name of
111 plugin_data_pb2.SessionStartInfo.
112 group_name: See the comment for the field with the same name of
113 plugin_data_pb2.SessionStartInfo.
114 start_time_secs: float. The time to use as the session start time.
115 Represented as seconds since the UNIX epoch. If None uses
116 the current time.
117 Returns:
118 The summary protobuffer mentioned above.
119 """
120 if start_time_secs is None:
121 start_time_secs = time.time()
122 session_start_info = plugin_data_pb2.SessionStartInfo(
123 model_uri=model_uri,
124 monitor_url=monitor_url,
125 group_name=group_name,
126 start_time_secs=start_time_secs,
127 )
128 for hp_name, hp_val in hparams.items():
129 # Boolean typed values need to be checked before integers since in Python
130 # isinstance(True/False, int) returns True.
131 if isinstance(hp_val, bool):
132 session_start_info.hparams[hp_name].bool_value = hp_val
133 elif isinstance(hp_val, (float, int)):
134 session_start_info.hparams[hp_name].number_value = hp_val
135 elif isinstance(hp_val, str):
136 session_start_info.hparams[hp_name].string_value = hp_val

Callers

nothing calls this directly

Calls 3

_summaryFunction · 0.85
itemsMethod · 0.80
timeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…