def _build_session_metric_values(self, session_name): """Builds the session metric values.""" # result is a list of api_pb2.MetricValue instances. result = [] metric_infos = self._experiment.metric_infos for metric_info in metric_infos: metric_name = metric_info.name try: metric_eval = metrics.last_metric_eval( self._context.multiplexer, session_name, metric_name) except KeyError: # It's ok if we don't find the metric in the session. # We skip it here. For filtering and sorting purposes its value is None. continue # metric_eval is a 3-tuple of the form [wall_time, step, value] result.append( api_pb2.MetricValue( name=metric_name, wall_time_secs=metric_eval[0], training_step=metric_eval[1], value=metric_eval[2], )) return result
def _build_session_metric_values(self, session_name, all_metric_evals): """Builds the session metric values.""" # result is a list of api_pb2.MetricValue instances. result = [] metric_infos = self._experiment.metric_infos for metric_info in metric_infos: metric_name = metric_info.name (run, tag) = metrics.run_tag_from_session_and_metric( session_name, metric_name) datum = all_metric_evals.get(run, {}).get(tag) if not datum: # It's ok if we don't find the metric in the session. # We skip it here. For filtering and sorting purposes its value is None. continue result.append( api_pb2.MetricValue( name=metric_name, wall_time_secs=datum.wall_time, training_step=datum.step, value=datum.value, )) return result