              self._add_trace_variables()
          else:
              self.display_item = None
              self._clear_trace_variables()
  
      def display_item_process(self):
          """ Add a single graph to the graph window """
 
</s> remove             if self.trace_var is not None:
                smooth_amount_var.trace_vdelete("w", self.trace_var)
                self.trace_var = None
 </s> add             self._clear_trace_variables() </s> remove         loss_keys = [key for key in self.display_item.loss_keys if key != "total"]
 </s> add         loss_keys = [key
                     for key in self.display_item.get_loss_keys(Session.session_ids[-1])
                     if key != "total"] </s> remove             self.display_item = session
            if self.trace_var is None:
                self.trace_var = smooth_amount_var.trace("w", self.smooth_amount_callback)
 </s> add             self.display_item = Session
            self._add_trace_variables() </s> remove         if self.trace_var is not None:
            get_config().tk_vars["smoothgraph"].trace_vdelete("w", self.trace_var)
            self.trace_var = None
 </s> add         self._clear_trace_variables()
            logger.trace("Clearing graph")
              self._add_trace_variables()
          else:
            logger.trace("Clearing graph")
              self.display_item = None
              self._clear_trace_variables()
  
      def display_item_process(self):
          """ Add a single graph to the graph window """
keep add 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/display_command.py