          for selection in self._selections:
              if selection == "raw":
                  continue
              logger.debug("Calculating: %s", selection)
              method = getattr(self, "_calc_{}".format(selection))
              raw_keys = [key for key in self._stats if key.startswith("raw_")]
              for key in raw_keys:
                  selected_key = "{}_{}".format(selection, key.replace("raw_", ""))
                  self._stats[selected_key] = method(self._stats[key])
  
 
</s> remove                 selected_key = "{}_{}".format(selection, key.replace("raw_", ""))
 </s> add                 selected_key = f"{selection}_{key.replace('raw_', '')}" </s> remove         loss_keys = [key
                     for key in self.display_item.get_loss_keys(Session.session_ids[-1])
                     if key != "total"]
 </s> add         loss_keys = self.display_item.get_loss_keys(Session.session_ids[-1])
        if not loss_keys:
            # Reload if we attempt to get loss keys before data is written
            logger.debug("Waiting for Session Data to become available to graph")
            self.after(1000, self.display_item_process)
            return

        loss_keys = [key for key in loss_keys if key != "total"] </s> remove             stats = dict()
 </s> add             stats = {} </s> remove                 print("'{}' is not a valid selection. Please try again".format(selection))
 </s> add                 print(f"'{selection}' is not a valid selection. Please try again") </s> remove             retval = dict()
 </s> add             retval = {}
            method = getattr(self, f"_calc_{selection}")
          for selection in self._selections:
              if selection == "raw":
                  continue
              logger.debug("Calculating: %s", selection)
            method = getattr(self, f"_calc_{selection}")
              raw_keys = [key for key in self._stats if key.startswith("raw_")]
              for key in raw_keys:
                  selected_key = "{}_{}".format(selection, key.replace("raw_", ""))
                  self._stats[selected_key] = method(self._stats[key])
  
keep keep keep keep replace keep keep keep keep keep
 Update code to support Tensorflow versions up to 2.8 (#1213)

* Update maximum tf version in setup + requirements

* - bump max version of tf version in launcher
- standardise tf version check

* update keras get_custom_objects  for tf>2.6

* bugfix: force black text in GUI file dialogs (linux)

* dssim loss - Move to stock tf.ssim function

* Update optimizer imports for compatibility

* fix logging for tf2.8

* Fix GUI graphing for TF2.8

* update tests

* bump requirements.txt versions

* Remove limit on nvidia-ml-py

* Graphing bugfixes
  - Prevent live graph from displaying if data not yet available

* bugfix: Live graph. Collect loss labels correctly

* fix: live graph - swallow inconsistent loss errors

* Bugfix: Prevent live graph from clearing during training

* Fix graphing for AMD 
lib/gui/analysis/stats.py