  #!/usr/bin/env python3
  """ Custom Initializers for faceswap.py
      Initializers from:
          shoanlu GAN: https://github.com/shaoanlu/faceswap-GAN"""
  
  import logging
  import sys
  import inspect
  
 
</s> remove logger = logging.getLogger(__name__)  # pylint: disable=invalid-name


def icnr_keras(shape, dtype=None):
    """
    Custom initializer for subpix upscaling
    From https://github.com/kostyaev/ICNR
    Note: upscale factor is fixed to 2, and the base initializer is fixed to random normal.
    """
    # TODO Roll this into ICNR_init when porting GAN 2.2
    shape = list(shape)
    scale = 2
    initializer = tf.keras.initializers.RandomNormal(0, 0.02)
 </s> add from lib.utils import get_backend </s> remove     def __call__(self, shape, dtype='float32'):  # tf needs partition_info=None
 </s> add     def __call__(self, shape, dtype="float32"):
        """ Call function for the ICNR initializer.

        Parameters
        ----------
        shape: tuple or list
            The required resized shape for the output tensor
        dtype: str
            The data type for the tensor

        Returns
        -------
        tensor
            The modified kernel weights
        """ </s> remove     '''
    ICNR initializer for checkerboard artifact free sub pixel convolution
 </s> add     """ ICNR initializer for checkerboard artifact free sub pixel convolution

    Parameters
    ----------
    initializer: :class:`keras.initializers.Initializer`
        The initializer used for sub kernels (orthogonal, glorot uniform, etc.)
    scale: int
        scaling factor of sub pixel convolution (up sampling from 8x8 to 16x16 is scale 2)

    Returns
    -------
    tensor
        The modified kernel weights </s> remove     Parameters:
        initializer: initializer used for sub kernels (orthogonal, glorot uniform, etc.)
        scale: scale factor of sub pixel convolution (upsampling from 8x8 to 16x16 is scale 2)
    Return:
        The modified kernel weights
    Example:
        x = conv2d(... weights_initializer=ICNR(initializer=he_uniform(), scale=2))
    '''
 </s> add     References
    ----------
    Andrew Aitken et al. Checkerboard artifact free sub-pixel convolution
    https://arxiv.org/pdf/1707.02937.pdf,  https://distill.pub/2016/deconv-checkerboard/
    """ </s> remove     Andrew Aitken et al. Checkerboard artifact free sub-pixel convolution
    https://arxiv.org/pdf/1707.02937.pdf	https://distill.pub/2016/deconv-checkerboard/
 </s> add     Example
    -------
        >>> x = conv2d(... weights_initializer=ICNR(initializer=he_uniform(), scale=2))
""" Custom Initializers for faceswap.py """
  #!/usr/bin/env python3
""" Custom Initializers for faceswap.py """
""" Custom Initializers for faceswap.py """
""" Custom Initializers for faceswap.py """
  
  import logging
  import sys
  import inspect
  
keep replace replace replace keep keep keep keep keep
 AMD: Fix ICNR Initialization for PlaidML backend 
lib/model/initializers.py