  
  
  class LossWrapper():  # pylint:disable=too-few-public-methods
      """ A wrapper class for multiple keras losses to enable multiple weighted loss functions on a
      single output.
  
      Parameters
      ----------
      loss_functions: list
          A list of either a tuple of (:class:`keras.losses.Loss`, scalar weight) or just a
          :class:`keras.losses.Loss` function. If just the loss function is passed, then the weight
          is assumed to be 1.0 """
      def __init__(self, loss_functions):
          logger.debug("Initializing: %s: (loss_functions: %s)",
                       self.__class__.__name__, loss_functions)
          self._loss_functions = []
          self._loss_weights = []
          self._compile_losses(loss_functions)
          logger.debug("Initialized: %s", self.__class__.__name__)
  
 
</s> remove 
    Parameters
    ----------
    loss_functions: list
        A list of either a tuple of (:class:`keras.losses.Loss`, scalar weight) or just a
        :class:`keras.losses.Loss` function. If just the loss function is passed, then the weight
        is assumed to be 1.0 """
    def __init__(self, loss_functions):
        logger.debug("Initializing: %s: (loss_functions: %s)",
                     self.__class__.__name__, loss_functions)
 </s> add     """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__) </s> remove     def _compile_losses(self, loss_functions):
        """ Splits the given loss_functions into the corresponding :attr:`_loss_functions' and
        :attr:`_loss_weights' lists.

        Loss functions are compiled into :class:`keras.compile_utils.LossesContainer` objects
 </s> add     def add_loss(self, function, weight=1.0, mask_channel=-1):
        """ Add the given loss function with the given weight to the loss function chain. </s> remove     def _compile_losses(self, loss_functions):
        """ Splits the given loss_functions into the corresponding :attr:`_loss_functions' and
        :attr:`_loss_weights' lists.

        Loss functions are compiled into :class:`keras.compile_utils.LossesContainer` objects
 </s> add     def add_loss(self, function, weight=1.0, mask_channel=-1):
        """ Add the given loss function with the given weight to the loss function chain. </s> remove         loss_functions: list
            A list of either a tuple of (:class:`keras.losses.Loss`, scalar weight) or just a
            :class:`keras.losses.Loss` function. If just the loss function is passed, then the
            weight is assumed to be 1.0 """
        for loss_func in loss_functions:
            if isinstance(loss_func, tuple):
                assert len(loss_func) == 2, "Tuple loss functions should contain 2 items"
                assert isinstance(loss_func[1], float), "weight should be a float"
                func, weight = loss_func
            else:
                func = loss_func
                weight = 1.0
            self._loss_functions.append(compile_utils.LossesContainer(func))
            self._loss_weights.append(weight)
        logger.debug("Compiled losses: (functions: %s, weights: %s",
                     self._loss_functions, self._loss_weights)
 </s> add         function: :class:`keras.losses.Loss`
            The loss function to add to the loss chain
        weight: float, optional
            The weighting to apply to the loss function. Default: `1.0`
        mask_channel: int, optional
            The channel in the `y_true` image that the mask exists in. Set to `-1` if there is no
            mask for the given loss function. Default: `-1`
        """
        logger.debug("Adding loss: (function: %s, weight: %s, mask_channel: %s)",
                     function, weight, mask_channel)
        self._loss_functions.append(compile_utils.LossesContainer(function))
        self._loss_weights.append(weight)
        self._mask_channels.append(mask_channel) </s> remove         loss_functions: list
            A list of either a tuple of (:class:`keras.losses.Loss`, scalar weight) or just a
            :class:`keras.losses.Loss` function. If just the loss function is passed, then the
            weight is assumed to be 1.0 """
        for loss_func in loss_functions:
            if isinstance(loss_func, tuple):
                assert len(loss_func) == 2, "Tuple loss functions should contain 2 items"
                assert isinstance(loss_func[1], float), "weight should be a float"
                func, weight = loss_func
            else:
                func = loss_func
                weight = 1.0
            self._loss_functions.append(func)
            self._loss_weights.append(weight)
        logger.debug("Compiled losses: (functions: %s, weights: %s",
                     self._loss_functions, self._loss_weights)
 </s> add         function: :class:`keras.losses.Loss`
            The loss function to add to the loss chain
        weight: float, optional
            The weighting to apply to the loss function. Default: `1.0`
        mask_channel: int, optional
            The channel in the `y_true` image that the mask exists in. Set to `-1` if there is no
            mask for the given loss function. Default: `-1`
        """
        logger.debug("Adding loss: (function: %s, weight: %s, mask_channel: %s)",
                     function, weight, mask_channel)
        self._loss_functions.append(function)
        self._loss_weights.append(weight)
        self._mask_channels.append(mask_channel)
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
  
  
  class LossWrapper():  # pylint:disable=too-few-public-methods
      """ A wrapper class for multiple keras losses to enable multiple weighted loss functions on a
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
    single output and masking.
    """
    def __init__(self):
        logger.debug("Initializing: %s", self.__class__.__name__)
          self._loss_functions = []
          self._loss_weights = []
          self._compile_losses(loss_functions)
          logger.debug("Initialized: %s", self.__class__.__name__)
  
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Add Mouth and Eye Priority to Loss options (#1054)

* Priority Training for Mouth and Eyes - Tensorflow

* Use chosen loss function for area multipliers

* loss multipliers for AMD

* Fix mask multipliers for plaid and roll PenalizedMaskLoss into LossWrapper

* losses_tf: roll PenalizedMaskLoss into LossWrapper 
lib/model/losses_plaid.py