  
  from lib import Serializer
  from lib.model.backup_restore import Backup
  from lib.model.losses import (DSSIMObjective, PenalizedLoss, gradient_loss, mask_loss_wrapper,
                                generalized_loss, l_inf_norm, gmsd_loss)
  from lib.model.masks import gaussian_blur
  from lib.model.nn_blocks import NNBlocks
  from lib.model.optimizers import Adam
  from lib.multithreading import MultiThread
  from lib.utils import deprecation_warning, FaceswapError
  from plugins.train._config import Config
 
</s> remove import keras.backend as K
 </s> add  </s> remove from .masks import gaussian_blur
 </s> add  </s> remove def gaussian_blur(radius=2.0):
    """ From https://github.com/iperov/DeepFaceLab
        Used for blurring mask in training """
    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 
                              generalized_loss, l_inf_norm, gmsd_loss, gaussian_blur)
  
  from lib import Serializer
  from lib.model.backup_restore import Backup
  from lib.model.losses import (DSSIMObjective, PenalizedLoss, gradient_loss, mask_loss_wrapper,
                              generalized_loss, l_inf_norm, gmsd_loss, gaussian_blur)
                              generalized_loss, l_inf_norm, gmsd_loss, gaussian_blur)
  from lib.model.nn_blocks import NNBlocks
  from lib.model.optimizers import Adam
  from lib.multithreading import MultiThread
  from lib.utils import deprecation_warning, FaceswapError
  from plugins.train._config import Config
keep keep keep keep replace replace keep keep keep keep keep
 Move gaussian_blur to losses (fixes plaidml race condition) 
plugins/train/model/_base.py