          list
              The loss keys for the given session. If ``None`` is passed as session_id then a unique
              list of all loss keys for all sessions is returned
          """
          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:
              assert self._tb_logs is not None
              loss_keys = {sess_id: list(logs.keys())
                           for sess_id, logs
                           in self._tb_logs.get_loss(session_id=session_id).items()}
  
          if session_id is None:
              retval: List[str] = list(set(loss_key
                                           for session in loss_keys.values()
                                           for loss_key in session))
 
</s> remove     def _mask_shapes(self) -> Optional[List[tuple]]:
 </s> add     def _mask_shapes(self) -> T.Optional[T.List[tuple]]: </s> remove     def _rewrite_plaid_outputs(self) -> None:
        """ Rewrite the output names for models using the PlaidML (Keras 2.2.4) backend

        Keras 2.2.4 duplicates model output names if any of the models have multiple outputs
        so we need to rename the outputs so we can successfully map the loss dictionaries.

        This is a bit of a hack, but it does work.
        """
        # TODO Remove this rewrite code if PlaidML updates to a version of Keras where this is
        # no longer necessary
        if len(self.model.output_names) == len(set(self.model.output_names)):
            logger.debug("Output names are unique, not rewriting: %s", self.model.output_names)
            return
        seen = {name: 0 for name in set(self.model.output_names)}
        new_names = []
        for name in self.model.output_names:
            new_names.append(f"{name}_{seen[name]}")
            seen[name] += 1
        logger.debug("Output names rewritten: (old: %s, new: %s)",
                     self.model.output_names, new_names)
        self.model.output_names = new_names

    def _legacy_mapping(self) -> Optional[dict]:
 </s> add     def _legacy_mapping(self) -> T.Optional[dict]: </s> remove     else:
        signature = inspect.signature(func)
        parameter = signature.parameters.get(name)
        if parameter is None:
            if accept_all:
                for param in signature.parameters.values():
                    if param.kind == inspect.Parameter.VAR_KEYWORD:
                        return True
            return False
        return (parameter.kind in (inspect.Parameter.POSITIONAL_OR_KEYWORD,
                                   inspect.Parameter.KEYWORD_ONLY))
 </s> add     signature = inspect.signature(func)
    parameter = signature.parameters.get(name)
    if parameter is None:
        if accept_all:
            for param in signature.parameters.values():
                if param.kind == inspect.Parameter.VAR_KEYWORD:
                    return True
        return False
    return (parameter.kind in (inspect.Parameter.POSITIONAL_OR_KEYWORD,
                               inspect.Parameter.KEYWORD_ONLY)) </s> remove     def _mask_inputs(self) -> Optional[list]:
 </s> add     def _mask_inputs(self) -> T.Optional[list]: </s> remove         retval: Dict[str, List[int]] = {}
 </s> add         retval: T.Dict[str, T.List[int]] = {}
        assert self._tb_logs is not None
        loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs
                     in self._tb_logs.get_loss(session_id=session_id).items()}
          list
              The loss keys for the given session. If ``None`` is passed as session_id then a unique
              list of all loss keys for all sessions is returned
          """
        assert self._tb_logs is not None
        loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs
                     in self._tb_logs.get_loss(session_id=session_id).items()}
        assert self._tb_logs is not None
        loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs
                     in self._tb_logs.get_loss(session_id=session_id).items()}
        assert self._tb_logs is not None
        loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs
                     in self._tb_logs.get_loss(session_id=session_id).items()}
        assert self._tb_logs is not None
        loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs
                     in self._tb_logs.get_loss(session_id=session_id).items()}
        assert self._tb_logs is not None
        loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs
                     in self._tb_logs.get_loss(session_id=session_id).items()}
        assert self._tb_logs is not None
        loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs
                     in self._tb_logs.get_loss(session_id=session_id).items()}
        assert self._tb_logs is not None
        loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs
                     in self._tb_logs.get_loss(session_id=session_id).items()}
        assert self._tb_logs is not None
        loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs
                     in self._tb_logs.get_loss(session_id=session_id).items()}
        assert self._tb_logs is not None
        loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs
                     in self._tb_logs.get_loss(session_id=session_id).items()}
  
          if session_id is None:
              retval: List[str] = list(set(loss_key
                                           for session in loss_keys.values()
                                           for loss_key in session))
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Remove plaidML support (#1325)

* Remove PlaidML reference from readme files

* Remove AMD option from installers

* remove amd requirements and update setup.py

* remove plaidml test from CI workflow

* gpustats: remove plaidml backend

* plaid removals:
  - faceswap.py - python version check
  - setup.cfg - plaidml typing ignore
  - lib.keras_utils - All plaid code
  - lib.launcher.py - All plaidml checks and configuration

* remove tf2.2 specific code from GUI event reader

* lib.model - remove all plaidml implementations

* plugins.extract - remove plaidml code

* plugins.train remove plaidml code

* lib.convert - remove plaidml code

* tools.model: remove plaidml code

* Remove plaidML tests from unit tests

* remove plaidml_utils and docsting cleanups

* Remove plaidML refs from configs

* fix keras imports 
lib/gui/analysis/stats.py