                        the mask by.
          preprocessing_func: The preprocessing function to use. Should take a Keras Input
                              as it's only input
      """
  
      def scale_mask(mask, scaling):
          """ Scale the input mask to be the same size as the input face """
          if scaling != 1.0:
              size = round(1 / scaling)
              mask = K.pool2d(mask,
                              pool_size=(size, size),
                              strides=(size, size),
 
</s> remove     """ Plaidml + tf Penalized loss function
        mask_scaling: For multi-decoder output the target mask will likely be at
                      full size scaling, so this is the scaling factor to reduce
                      the mask by.
        preprocessing_func: The preprocessing function to use. Should take a Keras Input
                            as it's only input
 </s> add     """ Plaidml and Tensorflow Penalized Loss function.

    Applies the given loss function just to the masked area of the image.

    Parameters
    ----------
    mask: input tensor
        The mask for the current image
    loss_func: function
        The actual loss function to use
    mask_prop: float, optional
        The amount of mask propagation. Default: `1.0`
    mask_scaling: float, optional
        For multi-decoder output the target mask will likely be at full size scaling, so this is
        the scaling factor to reduce the mask by. Default: `1.0`
    preprocessing_func: function, optional
        If preprocessing is required on the input mask, then this should be the function to use.
        The function should take a Keras Input as it's only argument. Set to ``None`` if no
        preprocessing is to be performed. Default: ``None`` </s> remove     """ A wrapper for mask loss that can perform pre-processing on the input
        prior to calling the loss function
        loss_func: The loss function to use
        preprocessing_func: The preprocessing function to use. Should take a Keras Input
        as it's only argument """

 </s> add     """ A wrapper for mask loss that can perform pre-processing on the input prior to calling the
    loss function.

    Parameters
    ----------
    loss_func: class or function
        The actual loss function to use
    preprocessing_func: function
        The pre-processing function to use. Should take a Keras Input as it's only argument
    """ </s> remove     """ From https://github.com/iperov/DeepFaceLab
        Used for blurring mask in training """
    def gaussian(var_x, radius, sigma):
 </s> add     """ Apply gaussian blur to an input.

    Used for blurring mask in training.

    Parameters
    ----------
    radius: float, optional
        The kernel radius for applying gaussian blur. Default: `2.0`

    Returns
    -------
    tensor
        The input tensor with gaussian blurring applied

    References
    ----------
    https://github.com/iperov/DeepFaceLab
    """
    def _gaussian(var_x, radius, sigma):
        """ Obtain the gaussian kernel. """ </s> remove     def inner_loss(y_true, y_pred):
        # Branching because tensorflows broadcasting is wonky and
        # plaidmls concatenate is implemented ineficient.
 </s> add     def _inner_loss(y_true, y_pred):
        """ Apply the loss function to the masked area of the image.

         Parameters
        ----------
        y_true: tensor or variable
            The ground truth value
        y_pred: tensor or variable
            The predicted value

        Returns
        -------
        tensor
            The Loss value

        Notes
        -----
        Branching because TensorFlow's broadcasting is wonky and plaidML's concatenate is
        implemented inefficiently.
        """ </s> remove     mask = scale_mask(mask, mask_scaling)
 </s> add     mask = _scale_mask(mask, mask_scaling)
    def _scale_mask(mask, scaling):
        """ Scale the input mask to be the same size as the input face

        Parameters
        ----------
        mask: input tensor
            The mask for the current image
        scaling: float
            The amount to scale the input mask by

        Returns
        -------
        tensor
            The resized input mask
        """
                        the mask by.
          preprocessing_func: The preprocessing function to use. Should take a Keras Input
                              as it's only input
      """
    def _scale_mask(mask, scaling):
        """ Scale the input mask to be the same size as the input face

        Parameters
        ----------
        mask: input tensor
            The mask for the current image
        scaling: float
            The amount to scale the input mask by

        Returns
        -------
        tensor
            The resized input mask
        """
    def _scale_mask(mask, scaling):
        """ Scale the input mask to be the same size as the input face

        Parameters
        ----------
        mask: input tensor
            The mask for the current image
        scaling: float
            The amount to scale the input mask by

        Returns
        -------
        tensor
            The resized input mask
        """
    def _scale_mask(mask, scaling):
        """ Scale the input mask to be the same size as the input face

        Parameters
        ----------
        mask: input tensor
            The mask for the current image
        scaling: float
            The amount to scale the input mask by

        Returns
        -------
        tensor
            The resized input mask
        """
          if scaling != 1.0:
              size = round(1 / scaling)
              mask = K.pool2d(mask,
                              pool_size=(size, size),
                              strides=(size, size),
keep keep keep keep replace replace replace keep keep keep keep keep
 Simple backend unit tests (#1020)

* Add simple backend tests for lib.model
* Document lib.model
* Fix GMSD Loss for AMD
* Remove obsolete code from lib.model 
lib/model/losses.py