  """ Neural Network Blocks for faceswap.py. """
  
  import logging
  
  from keras.layers import Add, SeparableConv2D
  from keras.layers.advanced_activations import LeakyReLU
  from keras.layers.convolutional import Conv2D
  from keras.layers.core import Activation
  from keras.initializers import he_uniform, VarianceScaling
  from .initializers import ICNR, ConvolutionAware
 
</s> remove import sys
import types

from keras.initializers import RandomNormal
from keras.layers import Add, Dense, Flatten, Input, Reshape, AveragePooling2D, LeakyReLU
from keras.layers.convolutional import UpSampling2D, Conv2DTranspose
 </s> add from keras.layers import Dense, Flatten, Input, Reshape, AveragePooling2D, LeakyReLU
from keras.layers import UpSampling2D </s> remove     Acknowledgements:
    kvrooman for numrious insights and invaluable aid
 </s> add     Acknowledgments:
    kvrooman for numerous insights and invaluable aid </s> remove # [P] TODO Move upscale2x_hyb to nnblocks.py (after testing)
# <<< DeLight Model Blocks >>> #
def upscale2x_hyb(self, inp, filters, kernel_size=3, padding='same',
                  sr_ratio=0.5, scale_factor=2, interpolation='bilinear',
                  res_block_follows=False, **kwargs):
    """Hybrid Upscale Layer"""
    name = self._get_name("upscale2x_hyb")
    var_x = inp

    sr_filters = int(filters * sr_ratio)
    upscale_filters = filters - sr_filters

    var_x_sr = self.upscale(var_x, upscale_filters, kernel_size=kernel_size,
                            padding=padding, scale_factor=scale_factor,
                            res_block_follows=res_block_follows, **kwargs)
    if upscale_filters > 0:
        var_x_us = self.conv2d(var_x, upscale_filters,  kernel_size=3, padding=padding,
                               name="{}_conv2d".format(name), **kwargs)
        var_x_us = UpSampling2D(size=(scale_factor, scale_factor), interpolation=interpolation,
                                name="{}_upsampling2D".format(name))(var_x_us)
        var_x = Concatenate(name="{}_concatenate".format(name))([var_x_sr, var_x_us])
    else:
        var_x = var_x_sr

    return var_x


def upscale2x_fast(self, inp, filters, kernel_size=3, padding='same',
                   sr_ratio=0.5, scale_factor=2, interpolation='bilinear',
                   res_block_follows=False, **kwargs):
    """Fast Upscale Layer"""
    name = self._get_name("upscale2x_fast")
    var_x = inp

    var_x2 = self.conv2d(var_x, filters,  kernel_size=3, padding=padding,
                         name="{}_conv2d".format(name), **kwargs)
    var_x2 = UpSampling2D(size=(scale_factor, scale_factor), interpolation=interpolation,
                          name="{}_upsampling2D".format(name))(var_x2)

    var_x1 = self.upscale(var_x, filters, kernel_size=kernel_size,
                          padding=padding, scale_factor=scale_factor,
                          res_block_follows=res_block_follows, **kwargs)
    var_x = Add()([var_x2, var_x1])
    return var_x


 </s> add  </s> remove         # monkey patch-in nn_blocks
        self.blocks.upscale2x_hyb = types.MethodType(upscale2x_hyb, self.blocks)
        self.blocks.upscale2x_fast = types.MethodType(upscale2x_fast, self.blocks)
 </s> add 
from keras.layers import Add, Concatenate, SeparableConv2D, UpSampling2D
  """ Neural Network Blocks for faceswap.py. """
  
  import logging
  
from keras.layers import Add, Concatenate, SeparableConv2D, UpSampling2D
  from keras.layers.advanced_activations import LeakyReLU
  from keras.layers.convolutional import Conv2D
  from keras.layers.core import Activation
  from keras.initializers import he_uniform, VarianceScaling
  from .initializers import ICNR, ConvolutionAware
keep keep keep keep replace keep keep keep keep keep
 Move custom dlight blocks to nn_blocks 
lib/model/nn_blocks.py