  import tensorflow as tf
  from tensorflow.distributions import Beta
  
  from .normalization import InstanceNormalization
  if K.backend() == "plaidml.keras.backend":
      from plaidml.op import extract_image_patches
  else:
      from tensorflow import extract_image_patches  # pylint: disable=ungrouped-imports
  
 
</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 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         # Only return the output shape of the face
 </s> add 
from .masks import gaussian_blur
  import tensorflow as tf
  from tensorflow.distributions import Beta
  
from .masks import gaussian_blur
  from .normalization import InstanceNormalization
  if K.backend() == "plaidml.keras.backend":
      from plaidml.op import extract_image_patches
  else:
      from tensorflow import extract_image_patches  # pylint: disable=ungrouped-imports
  
keep keep add keep keep keep keep keep keep
 Fix penalized loss for multiscale decoders 
lib/model/losses.py