          """ dict: The loss for the current session id for each loss key """
          loss_dict = self.tb_logs.get_loss(session=self.session_id)[self.session_id]
          return loss_dict
  
      @property
      def loss_keys(self):
          """ list: The loss keys for the current session, or loss keys for all sessions. """
          if self.session_id is None:
              retval = self._total_loss_keys
          else:
              retval = self.session["loss_names"]
          return retval
  
      @property
      def lowest_loss(self):
          """ Return the lowest average loss per save iteration seen """
          return self.state["lowest_avg_loss"]
 
</s> remove     @property
    def loss(self):
        """ dict: The loss for the current session id for each loss key """
        loss_dict = self.tb_logs.get_loss(session=self.session_id)[self.session_id]
        return loss_dict
 </s> add class SessionsSummary():  # pylint:disable=too-few-public-methods
    """ Performs top level summary calculations for each session ID within the loaded or currently
    training Session for display in the Analysis tree view. </s> remove     @property
    def lowest_loss(self):
        """ Return the lowest average loss per save iteration seen """
        return self.state["lowest_avg_loss"]
 </s> add         self._time_stats = None
        self._per_session_stats = None
        logger.debug("Initialized %s", self.__class__.__name__) </s> remove     @property
    def total_loss(self):
        """ dict: The collated loss for all sessions for each loss key """
        loss_dict = dict()
        all_loss = self.tb_logs.get_loss()
        for key in sorted(all_loss):
            for loss_key, loss in all_loss[key].items():
                loss_dict.setdefault(loss_key, []).extend(loss)
        return loss_dict
 </s> add             self._time_stats = {
                sess_id: dict(start_time=np.min(timestamps) if np.any(timestamps) else 0,
                              end_time=np.max(timestamps) if np.any(timestamps) else 0,
                              iterations=timestamps.shape[0] if np.any(timestamps) else 0)
                for sess_id, timestamps in self._session.get_timestamps(None).items()} </s> remove     @property
    def session(self):
        """ Return current session dictionary """
        return self.state["sessions"].get(str(self.session_id), dict())
 </s> add     def get_summary_stats(self):
        """ Compile the individual session statistics and calculate the total. </s> remove     @property
    def _total_loss_keys(self):
        """ list: The loss keys for all sessions. """
        loss_keys = set(loss_key
                        for session in self.state["sessions"].values()
                        for loss_key in session["loss_names"])
        return list(loss_keys)
 </s> add         elif Session.is_training:
            logger.debug("Updating summary time stamps for training session")
    Parameters
    ----------
    session: :class:`GlobalSession`
        The loaded or currently training session
    """
    def __init__(self, session):
        logger.debug("Initializing %s: (session: %s)", self.__class__.__name__, session)
        self._session = session
        self._state = session._state
          """ dict: The loss for the current session id for each loss key """
          loss_dict = self.tb_logs.get_loss(session=self.session_id)[self.session_id]
          return loss_dict
  
    Parameters
    ----------
    session: :class:`GlobalSession`
        The loaded or currently training session
    """
    def __init__(self, session):
        logger.debug("Initializing %s: (session: %s)", self.__class__.__name__, session)
        self._session = session
        self._state = session._state
    Parameters
    ----------
    session: :class:`GlobalSession`
        The loaded or currently training session
    """
    def __init__(self, session):
        logger.debug("Initializing %s: (session: %s)", self.__class__.__name__, session)
        self._session = session
        self._state = session._state
    Parameters
    ----------
    session: :class:`GlobalSession`
        The loaded or currently training session
    """
    def __init__(self, session):
        logger.debug("Initializing %s: (session: %s)", self.__class__.__name__, session)
        self._session = session
        self._state = session._state
    Parameters
    ----------
    session: :class:`GlobalSession`
        The loaded or currently training session
    """
    def __init__(self, session):
        logger.debug("Initializing %s: (session: %s)", self.__class__.__name__, session)
        self._session = session
        self._state = session._state
    Parameters
    ----------
    session: :class:`GlobalSession`
        The loaded or currently training session
    """
    def __init__(self, session):
        logger.debug("Initializing %s: (session: %s)", self.__class__.__name__, session)
        self._session = session
        self._state = session._state
    Parameters
    ----------
    session: :class:`GlobalSession`
        The loaded or currently training session
    """
    def __init__(self, session):
        logger.debug("Initializing %s: (session: %s)", self.__class__.__name__, session)
        self._session = session
        self._state = session._state
    Parameters
    ----------
    session: :class:`GlobalSession`
        The loaded or currently training session
    """
    def __init__(self, session):
        logger.debug("Initializing %s: (session: %s)", self.__class__.__name__, session)
        self._session = session
        self._state = session._state
    Parameters
    ----------
    session: :class:`GlobalSession`
        The loaded or currently training session
    """
    def __init__(self, session):
        logger.debug("Initializing %s: (session: %s)", self.__class__.__name__, session)
        self._session = session
        self._state = session._state
  
      @property
      def lowest_loss(self):
          """ Return the lowest average loss per save iteration seen """
          return self.state["lowest_avg_loss"]
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
 GUI - Stats optimization (#1067)

* Faster stat loading + caching

* Compress data in cache

* Optimize some calculations

* Vectorize smoothing

* stats.Calculations optimized

* Load latest training data from live iterator

* Add options to training graph 
lib/gui/stats.py