  # <<< START: from DFL >>> #
  def style_loss(gaussian_blur_radius=0.0, loss_weight=1.0, wnd_size=0, step_size=1):
      """ Style Loss from DeepFaceLab
          https://github.com/iperov/DeepFaceLab """
      def gaussian_blur(radius=2.0):
          def gaussian(var_x, radius, sigma):
              return np.exp(-(float(var_x) - float(radius)) ** 2 / (2 * sigma ** 2))
  
          def make_kernel(sigma):
              kernel_size = max(3, int(2 * 2 * sigma + 1))
              mean = np.floor(0.5 * kernel_size)
              kernel_1d = np.array([gaussian(x, mean, sigma) for x in range(kernel_size)])
              np_kernel = np.outer(kernel_1d, kernel_1d).astype(dtype=K.floatx())
              kernel = np_kernel / np.sum(np_kernel)
              return kernel
  
          gauss_kernel = make_kernel(radius)
          gauss_kernel = gauss_kernel[:, :, np.newaxis, np.newaxis]
  
          def func(input_):
              inputs = [input_[:, :, :, i:i + 1] for i in range(K.int_shape(input_)[-1])]
              outputs = [K.conv2d(inp, K.constant(gauss_kernel), strides=(1, 1), padding="same")
                         for inp in inputs]
              return K.concatenate(outputs, axis=-1)
          return func
  
      if gaussian_blur_radius > 0.0:
          gblur = gaussian_blur(gaussian_blur_radius)
  
      def std(content, style, loss_weight):
 
</s> remove def PenalizedLoss(mask, loss_func, mask_prop=1.0):  # pylint: disable=invalid-name
 </s> add def PenalizedLoss(mask, loss_func, mask_prop=1.0, mask_scaling=1.0):  # pylint: disable=invalid-name </s> remove     def largest_output(self):
        """ Return the index of the largest face output """
        max_size = max(shape[0] for shape in self.loss_shapes if shape[2] == 3)
        largest_idx = [idx for idx, shape in enumerate(self.loss_shapes)
                       if shape[0] == max_size and shape[2] == 3][0]
        return largest_idx
 </s> add     def mask_input(self):
        """ Return the mask input or None """
        mask_inputs = [inp for inp in self.inputs if inp.name.startswith("mask")]
        if not mask_inputs:
            return None
        return mask_inputs[0]

    @property
    def mask_shape(self):
        """ Return the mask shape """
        if self.mask_input is None:
            return None
        return K.int_shape(self.mask_input)[1:] </s> remove     def get_loss_functions(self, mask):
 </s> add     def get_loss_functions(self): </s> remove     def __init__(self, outputs, mask_input):
        logger.debug("Initializing %s: (outputs: '%s', mask_input: '%s')",
                     self.__class__.__name__, outputs, mask_input)
 </s> add     def __init__(self, inputs, outputs):
        logger.debug("Initializing %s: (inputs: %s, outputs: %s)",
                     self.__class__.__name__, inputs, outputs)
        self.inputs = inputs
  # <<< START: from DFL >>> #
  def style_loss(gaussian_blur_radius=0.0, loss_weight=1.0, wnd_size=0, step_size=1):
      """ Style Loss from DeepFaceLab
          https://github.com/iperov/DeepFaceLab """





















  
      if gaussian_blur_radius > 0.0:
          gblur = gaussian_blur(gaussian_blur_radius)
  
      def std(content, style, loss_weight):
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Fix penalized loss for multiscale decoders 
lib/model/losses.py