original_docstring:  Populate the attribute :attr:`_per_session_stats` with a sorted list by session ID
          of each ID in the training/loaded session. Stats contain the session ID, start, end and
          elapsed times, the training rate, batch size and number of iterations for each session.
  
          If a training session is running, then updates the training sessions stats only.
          
docstring: Populate the attribute :attr:`_per_session_stats` with a sorted list by session ID
  of each ID in the training/loaded session. Stats contain the session ID, start, end and
  elapsed times, the training rate, batch size and number of iterations for each session.
  
  If a training session is running, then updates the training sessions stats only.
docstring_tokens: Populate the attribute : attr : ` _per_session_stats ` with a sorted list by session ID of each ID in the training / loaded session . Stats contain the session ID start end and elapsed times the training rate batch size and number of iterations for each session . If a training session is running then updates the training sessions stats only .
code: def _get_per_session_stats(self):
          """ Populate the attribute :attr:`_per_session_stats` with a sorted list by session ID
          of each ID in the training/loaded session. Stats contain the session ID, start, end and
          elapsed times, the training rate, batch size and number of iterations for each session.
  
          If a training session is running, then updates the training sessions stats only.
          """
          if self._per_session_stats is None:
              logger.debug("Collating per session stats")
              compiled = list()
              for session_id, ts_data in self._time_stats.items():
                  logger.debug("Compiling session ID: %s", session_id)
                  if self._state is None:
                      logger.debug("Session state dict doesn't exist. Most likely task has been "
                                   "terminated during compilation")
                      return
                  compiled.append(self._collate_stats(session_id, ts_data))
  
              self._per_session_stats = list(sorted(compiled, key=lambda k: k["session"]))
  
          elif self._session.is_training:
              logger.debug("Collating per session stats for latest training data")
              session_id = self._session.session_ids[-1]
              ts_data = self._time_stats[session_id]
  
              if session_id > len(self._per_session_stats):
                  self._per_session_stats.append(self._collate_stats(session_id, ts_data))
  
              stats = self._per_session_stats[-1]
  
              stats["start"] = ts_data["start_time"]
              stats["end"] = ts_data["end_time"]
              stats["elapsed"] = int(stats["end"] - stats["start"])
              stats["iterations"] = ts_data["iterations"]
              stats["rate"] = (((stats["batch"] * 2) * stats["iterations"])
                               / stats["elapsed"] if stats["elapsed"] != 0 else 0)
          logger.debug("per_session_stats: %s", self._per_session_stats)
code_tokens: def _get_per_session_stats ( self ) : if self . _per_session_stats is None : logger . debug ( "Collating per session stats" ) compiled = list ( ) for session_id , ts_data in self . _time_stats . items ( ) : logger . debug ( "Compiling session ID: %s" , session_id ) if self . _state is None : logger . debug ( "Session state dict doesn't exist. Most likely task has been " "terminated during compilation" ) return compiled . append ( self . _collate_stats ( session_id , ts_data ) ) self . _per_session_stats = list ( sorted ( compiled , key = lambda k : k [ "session" ] ) ) elif self . _session . is_training : logger . debug ( "Collating per session stats for latest training data" ) session_id = self . _session . session_ids [ - 1 ] ts_data = self . _time_stats [ session_id ] if session_id > len ( self . _per_session_stats ) : self . _per_session_stats . append ( self . _collate_stats ( session_id , ts_data ) ) stats = self . _per_session_stats [ - 1 ] stats [ "start" ] = ts_data [ "start_time" ] stats [ "end" ] = ts_data [ "end_time" ] stats [ "elapsed" ] = int ( stats [ "end" ] - stats [ "start" ] ) stats [ "iterations" ] = ts_data [ "iterations" ] stats [ "rate" ] = ( ( ( stats [ "batch" ] * 2 ) * stats [ "iterations" ] ) / stats [ "elapsed" ] if stats [ "elapsed" ] != 0 else 0 ) logger . debug ( "per_session_stats: %s" , self . _per_session_stats )
short_docstring: Populate the attribute :attr:`_per_session_stats` with a sorted list by session ID
  of each ID in the training/loaded session.
short_docstring_tokens: Populate the attribute : attr : ` _per_session_stats ` with a sorted list by session ID of each ID in the training / loaded session .
comment: """ Populate the attribute :attr:`_per_session_stats` with a sorted list by session ID
          of each ID in the training/loaded session. Stats contain the session ID, start, end and
          elapsed times, the training rate, batch size and number of iterations for each session.
  
          If a training session is running, then updates the training sessions stats only.
          """