  logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
  
  
  def mask_loss_wrapper(loss_func, preprocessing_func=None):
      """ 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 """
  
      def func(y_true, y_pred):
          """ Process input if a processing function has been passed, otherwise just return loss """
          if preprocessing_func is not None:
              y_true = K.reshape(y_true, [-1] + list(K.int_shape(y_pred)[1:]))
              y_true = preprocessing_func(y_true)
 
</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 
    def scale_mask(mask, scaling):
        """ Scale the input mask to be the same size as the input face """
 </s> add     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
        """ </s> remove def l_p_norm(y_true, y_pred, p_norm=np.inf):
    """
    Calculate the L-p norm as a loss function,
    valid choics of p are [0,1,no.inf]
    """
    diff = y_true - y_pred
    loss = tf.norm(diff, ord=p_norm, axis=-1)
    return loss


 </s> add  </s> remove     """ Calculate the L-inf norm as a loss function """
 </s> add     """ Calculate the L-inf norm as a loss function.

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

    Returns
    -------
    tensor
        The loss value
    """ </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.
        """
    """ 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
    """
  logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
  
  
  def mask_loss_wrapper(loss_func, preprocessing_func=None):
    """ 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
    """
    """ 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
    """
    """ 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
    """
    """ 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
    """
    """ 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
    """
    """ 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
    """
      def func(y_true, y_pred):
          """ Process input if a processing function has been passed, otherwise just return loss """
          if preprocessing_func is not None:
              y_true = K.reshape(y_true, [-1] + list(K.int_shape(y_pred)[1:]))
              y_true = preprocessing_func(y_true)
keep keep keep keep replace replace replace 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