                                       dict(beta_1=0.5, beta_2=0.99, epsilon=epsilon)),
                              "nadam": (optimizers.Nadam,
                                        dict(beta_1=0.5, beta_2=0.99, epsilon=epsilon)),
                              "rms-prop": (optimizers.RMSprop, dict(epsilon=epsilon))}
          self._optimizer, self._kwargs = valid_optimizers[optimizer]
  
          self._configure(learning_rate, autoclip)
          logger.verbose("Using %s optimizer", optimizer.title())  # type:ignore
          logger.debug("Initialized: %s", self.__class__.__name__)
  
 
</s> remove     def __init__(self, config: dict) -> None:
        logger.debug("Initializing %s", self.__class__.__name__)
 </s> add     def __init__(self, config: dict, color_order: Literal["bgr", "rgb"]) -> None:
        logger.debug("Initializing %s: (color_order: %s)", self.__class__.__name__, color_order) </s> remove     input_shape: tuple
        Required for AMD backends only. Some loss functions are unable to calculate the input shape
        at runtime, so we add the shape as an initializing variable
 </s> add     color_order: str
        Color order of the model. One of `"BGR"` or `"RGB"` </s> remove         self._loss = Loss(self.config)
 </s> add         self._loss = Loss(self.config, self.color_order) </s> remove         if len(self.input_shape) == 3:
            input_shapes = [self.input_shape, self.input_shape]
        else:
            input_shapes = self.input_shape
 </s> add         input_shapes = [self.input_shape, self.input_shape] </s> remove class MSSIMLoss():  # pylint:disable=too-few-public-methods
    """ Multiscale Structural Similarity Loss Function

    Parameters
    ----------
    k_1: float, optional
        Parameter of the SSIM. Default: `0.01`
    k_2: float, optional
        Parameter of the SSIM. Default: `0.03`
    filter_size: int, optional
        size of gaussian filter Default: `11`
    filter_sigma: float, optional
        Width of gaussian filter Default: `1.5`
    max_value: float, optional
        Max value of the output. Default: `1.0`
    power_factors: tuple, optional
        Iterable of weights for each of the scales. The number of scales used is the length of the
        list. Index 0 is the unscaled resolution's weight and each increasing scale corresponds to
        the image being downsampled by 2. Defaults to the values obtained in the original paper.
        Default: (0.0448, 0.2856, 0.3001, 0.2363, 0.1333)

    Notes
    ------
    You should add a regularization term like a l2 loss in addition to this one.
    """
    def __init__(self,
                 k_1: float = 0.01,
                 k_2: float = 0.03,
                 filter_size: int = 11,
                 filter_sigma: float = 1.5,
                 max_value: float = 1.0,
                 power_factors: Tuple[float, ...] = (0.0448, 0.2856, 0.3001, 0.2363, 0.1333)
                 ) -> None:
        self.filter_size = filter_size
        self.filter_sigma = filter_sigma
        self.k_1 = k_1
        self.k_2 = k_2
        self.max_value = max_value
        self.power_factors = power_factors

    def __call__(self, y_true: tf.Tensor, y_pred: tf.Tensor) -> tf.Tensor:
        """ Call the MS-SSIM Loss Function.

        Parameters
        ----------
        y_true: :class:`tf.Tensor`
            The ground truth value
        y_pred: :class:`tf.Tensor`
            The predicted value

        Returns
        -------
        :class:`tf.Tensor`
            The MS-SSIM Loss value
        """
        im_size = K.int_shape(y_true)[1]
        # filter size cannot be larger than the smallest scale
        smallest_scale = self._get_smallest_size(im_size, len(self.power_factors) - 1)
        filter_size = min(self.filter_size, smallest_scale)

        ms_ssim = tf.image.ssim_multiscale(y_true,
                                           y_pred,
                                           self.max_value,
                                           power_factors=self.power_factors,
                                           filter_size=filter_size,
                                           filter_sigma=self.filter_sigma,
                                           k1=self.k_1,
                                           k2=self.k_2)
        ms_ssim_loss = 1. - ms_ssim
        return K.mean(ms_ssim_loss)

    def _get_smallest_size(self, size: int, idx: int) -> int:
        """ Recursive function to obtain the smallest size that the image will be scaled to.

        Parameters
        ----------
        size: int
            The current scaled size to iterate through
        idx: int
            The current iteration to be performed. When iteration hits zero the value will
            be returned

        Returns
        -------
        int
            The smallest size the image will be scaled to based on the original image size and
            the amount of scaling factors that will occur
        """
        logger.debug("scale id: %s, size: %s", idx, size)
        if idx > 0:
            size = self._get_smallest_size(size // 2, idx - 1)
        return size


 </s> add 
        optimizer_info = valid_optimizers[optimizer]
        self._optimizer: Callable = optimizer_info[0]
        self._kwargs: Dict[str, Any] = optimizer_info[1]
                                       dict(beta_1=0.5, beta_2=0.99, epsilon=epsilon)),
                              "nadam": (optimizers.Nadam,
                                        dict(beta_1=0.5, beta_2=0.99, epsilon=epsilon)),
                              "rms-prop": (optimizers.RMSprop, dict(epsilon=epsilon))}
        optimizer_info = valid_optimizers[optimizer]
        self._optimizer: Callable = optimizer_info[0]
        self._kwargs: Dict[str, Any] = optimizer_info[1]
  
          self._configure(learning_rate, autoclip)
          logger.verbose("Using %s optimizer", optimizer.title())  # type:ignore
          logger.debug("Initialized: %s", self.__class__.__name__)
  
keep keep keep keep replace keep keep keep keep keep
 Add Flip Loss Function
    - Add Flip for AMD and TF
    - Split Perceptual Loss functions to own modules
    - Fix allowed input shape for models
    - Allow GUI tooltip to display at higher width 
plugins/train/model/_base/settings.py