          return patches
  
  
  # <<< START: from Dfaker >>> #
  def PenalizedLoss(mask, loss_func, mask_prop=1.0):  # pylint: disable=invalid-name
      """ Plaidml + tf Penalized loss function """
      mask_as_k_inv_prop = 1 - mask_prop
      mask = (mask * mask_prop) + mask_as_k_inv_prop
  
      def inner_loss(y_true, y_pred):
 
</s> remove     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
 </s> add  </s> remove     def loss_shapes(self):
 </s> add     def selected_loss(self):
        """ Return the selected loss function """
        retval = self.loss_dict[self.config.get("loss_function", "mae")]
        logger.debug(retval)
        return retval

    @property
    def selected_mask_loss(self):
        """ Return the selected mask loss function. Currently returns mse """
        retval = self.loss_dict["mse"]
        logger.debug(retval)
        return retval

    @property
    def output_shapes(self): </s> remove         output_types = ["mask" if shape[-1] == 1 else "face" for shape in self.loss_shapes]
 </s> add         output_types = ["mask" if shape[-1] == 1 else "face" for shape in self.output_shapes] </s> remove     def get_loss_functions(self, mask):
 </s> add     def get_loss_functions(self):
def PenalizedLoss(mask, loss_func, mask_prop=1.0, mask_scaling=1.0):  # pylint: disable=invalid-name
          return patches
  
  
  # <<< START: from Dfaker >>> #
def PenalizedLoss(mask, loss_func, mask_prop=1.0, mask_scaling=1.0):  # pylint: disable=invalid-name
      """ Plaidml + tf Penalized loss function """
      mask_as_k_inv_prop = 1 - mask_prop
      mask = (mask * mask_prop) + mask_as_k_inv_prop
  
      def inner_loss(y_true, y_pred):
keep keep keep keep replace keep keep keep keep keep
 Fix penalized loss for multiscale decoders 
lib/model/losses.py