          logs = {log[0]: log[1]
                  for log in zip(self._model.state.loss_names, loss)}
  
          self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)
  
      def _collate_and_store_loss(self, loss):
          """ Collate the loss into totals for each side.
  
 
</s> remove         retval = dict()
 </s> add         retval = {} </s> remove         loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs in self._tb_logs.get_loss(session_id=session_id).items()}
 </s> add         if get_backend() == "amd":
            # We can't log the graph in Tensorboard logs for AMD so need to obtain from state file
            loss_keys = {int(sess_id): [name for name in session["loss_names"] if name != "total"]
                         for sess_id, session in self._state["sessions"].items()}
        else:
            loss_keys = {sess_id: list(logs.keys())
                         for sess_id, logs
                         in self._tb_logs.get_loss(session_id=session_id).items()}
 </s> remove         output = ", ".join(["Loss {}: {:.5f}".format(side, side_loss)
 </s> add         output = ", ".join([f"Loss {side}: {side_loss:.5f}" </s> remove         retval = dict()
 </s> add         retval = {} </s> remove                     data[event.step] = self._process_event(event, data.get(event.step, dict()))
 </s> add                     data[event.step] = self._process_event(event, data.get(event.step, {}))
        if get_tf_version() == 2.8:
            # Bug in TF 2.8 where batch recording got deleted.
            # ref: https://github.com/keras-team/keras/issues/16173
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._model._model._train_counter)  # pylint:disable=protected-access
          logs = {log[0]: log[1]
                  for log in zip(self._model.state.loss_names, loss)}
  
          self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)
        if get_tf_version() == 2.8:
            # Bug in TF 2.8 where batch recording got deleted.
            # ref: https://github.com/keras-team/keras/issues/16173
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._model._model._train_counter)  # pylint:disable=protected-access
  
      def _collate_and_store_loss(self, loss):
          """ Collate the loss into totals for each side.
  
keep keep keep add 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 
plugins/train/trainer/_base.py