              graph.save_fig(graphlocation)
  
      def close(self):
          """ Clear the plots from RAM """
          if self.trace_var is not None:
              get_config().tk_vars["smoothgraph"].trace_vdelete("w", self.trace_var)
              self.trace_var = None
          if self.subnotebook is None:
              logger.debug("No graphs to clear. Returning")
              return
          for name, graph in self.subnotebook.children.items():
              logger.debug("Clearing: %s", name)
 
</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             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:
                smooth_amount_var.trace_vdelete("w", self.trace_var)
                self.trace_var = None
        elif session.initialized:
 </s> add             self._clear_trace_variables()
        elif Session.is_training and self.display_item is None: </s> remove         session = get_config().session
        smooth_amount_var = get_config().tk_vars["smoothgraph"]
        if session.initialized and session.logging_disabled:
 </s> add         if Session.is_training and Session.logging_disabled:
        self._clear_trace_variables()
              graph.save_fig(graphlocation)
  
      def close(self):
          """ Clear the plots from RAM """
        self._clear_trace_variables()
        self._clear_trace_variables()
        self._clear_trace_variables()
          if self.subnotebook is None:
              logger.debug("No graphs to clear. Returning")
              return
          for name, graph in self.subnotebook.children.items():
              logger.debug("Clearing: %s", name)
keep keep keep keep 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/display_command.py