          logger.trace("Updating TensorBoard log")  # type: ignore
          logs = {log[0]: log[1]
                  for log in zip(self._model.state.loss_names, loss)}
  
          if get_tf_version() > (2, 7):
              # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
              # ref: https://github.com/keras-team/keras/issues/16173
              with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa pylint:disable=protected-access,not-context-manager
                  for name, value in logs.items():
                      tf.summary.scalar(
                          "batch_" + name,
                          value,
                          step=self._tensorboard._train_step)  # pylint:disable=protected-access
          else:
              self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)
  
      def _collate_and_store_loss(self, loss: T.List[float]) -> T.List[float]:
          """ Collate the loss into totals for each side.
  
          The losses are summed into a total for each side. Loss totals are added to
          :attr:`model.state._history` to track the loss drop per save iteration for backup purposes.
  
 
</s> remove     def add_history(self, loss: T.List[float]) -> None:
 </s> add     def add_history(self, loss: list[float]) -> None: </s> remove     def _print_loss(self, loss: T.List[float]) -> None:
 </s> add     def _print_loss(self, loss: list[float]) -> None: </s> remove     def _should_backup(self, save_averages: T.List[float]) -> bool:
 </s> add     def _should_backup(self, save_averages: list[float]) -> bool: </s> remove         self._history: T.List[T.List[float]] = [[], []]  # Loss histories per save iteration
 </s> add         self._history: list[list[float]] = [[], []]  # Loss histories per save iteration </s> remove     def _get_save_averages(self) -> T.List[float]:
 </s> add     def _get_save_averages(self) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
          logger.trace("Updating TensorBoard log")  # type: ignore
          logs = {log[0]: log[1]
                  for log in zip(self._model.state.loss_names, loss)}
  
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
        # Bug in TF 2.8/2.9/2.10 where batch recording got deleted.
        # ref: https://github.com/keras-team/keras/issues/16173
        with tf.summary.record_if(True), self._tensorboard._train_writer.as_default():  # noqa:E501  pylint:disable=protected-access,not-context-manager
            for name, value in logs.items():
                tf.summary.scalar(
                    "batch_" + name,
                    value,
                    step=self._tensorboard._train_step)  # pylint:disable=protected-access
        # TODO revert this code if fixed in tensorflow
        # self._tensorboard.on_train_batch_end(self._model.iterations, logs=logs)

    def _collate_and_store_loss(self, loss: list[float]) -> list[float]:
          """ Collate the loss into totals for each side.
  
          The losses are summed into a total for each side. Loss totals are added to
          :attr:`model.state._history` to track the loss drop per save iteration for backup purposes.
  
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Rebase code (#1326)

* Remove tensorflow_probability requirement

* setup.py - fix progress bars

* requirements.txt: Remove pre python 3.9 packages

* update apple requirements.txt

* update INSTALL.md

* Remove python<3.9 code

* setup.py - fix Windows Installer

* typing: python3.9 compliant

* Update pytest and readthedocs python versions

* typing fixes

* Python Version updates
  - Reduce max version to 3.10
  - Default to 3.10 in installers
  - Remove incompatible 3.11 tests

* Update dependencies

* Downgrade imageio dep for Windows

* typing: merge optional unions and fixes

* Updates
  - min python version 3.10
  - typing to python 3.10 spec
  - remove pre-tf2.10 code
  - Add conda tests

* train: re-enable optimizer saving

* Update dockerfiles

* Update setup.py
  - Apple Conda deps to setup.py
  - Better Cuda + dependency handling

* bugfix: Patch logging to prevent Autograph errors

* Update dockerfiles

* Setup.py - Setup.py - stdout to utf-8

* Add more OSes to github Actions

* suppress mac-os end to end test 
plugins/train/trainer/_base.py