code: def create_discriminator(
      downsampling_blocks_num_channels: Sequence[Sequence[int]] = (
          (64, 128),
          (128, 128),
          (256, 256),
          (512, 512),
      ),
      relu_leakiness: float = 0.2,
      kernel_initializer: Optional[_KerasInitializer] = None,
      use_fan_in_scaled_kernels: bool = True,
      use_antialiased_bilinear_downsampling: bool = False,
      num_channels: int = 3,
      name: str = "style_gan_v2_discriminator",
  ):
      """Creates a Keras model for the discriminator architecture.
  
      This architecture is implemented accodring to "Analyzing and Improving the
      Image Quality of StyleGAN"
      https://arxiv.org/pdf/1912.04958.pdf
  
      Args:
        downsampling_blocks_num_channels: The number of channels in the downsampling
          blocks for each block the number of channels for the first and second
          convolution are specified.
        relu_leakiness: Slope of the negative part of the leaky relu.
        kernel_initializer: Initializer of the kernel. If none TruncatedNormal is
          used.
        use_fan_in_scaled_kernels: This rescales the kernels using the scale factor
          from the he initializer, which implements the equalized learning rate.
        use_antialiased_bilinear_downsampling: If true the downsampling operation is
          ani-aliased bilinear downsampling with a [1, 3, 3, 1] tent kernel. If
          false standard bilinear downsampling, i.e. average pooling is used ([1, 1]
          tent kernel).
        num_channels: The number of channels of the input tensor.
        name: The name of the Keras model.
  
      Returns:
        The generated discriminator keras model.
      """
      if kernel_initializer is None:
          kernel_initializer = tf.keras.initializers.TruncatedNormal(
              mean=0.0, stddev=1.0
          )
  
      input_tensor = tf.keras.Input(shape=(None, None, num_channels))
      tensor = architectures_progressive_gan.from_rgb(
          input_tensor=input_tensor,
          use_fan_in_scaled_kernel=use_fan_in_scaled_kernels,
          num_channels=downsampling_blocks_num_channels[0][0],
          kernel_initializer=kernel_initializer,
          relu_leakiness=relu_leakiness,
      )
  
      for index, (channels_1, channels_2) in enumerate(
          downsampling_blocks_num_channels
      ):
          with tf.name_scope(f"downsampling_block_{index}"):
              shortcut = tensor
  
              shortcut = architectures_progressive_gan.create_conv_layer(
                  use_fan_in_scaled_kernel=use_fan_in_scaled_kernels,
                  filters=channels_2,
                  kernel_size=1,
                  strides=1,
                  use_bias=False,
                  kernel_initializer=kernel_initializer,
              )(
                  shortcut
              )
              shortcut = tf.keras.layers.AveragePooling2D()(shortcut)
              if use_antialiased_bilinear_downsampling:
                  shortcut = keras_layers.Blur2D()(shortcut)
  
              tensor = architectures_progressive_gan.create_conv_layer(
                  use_fan_in_scaled_kernel=use_fan_in_scaled_kernels,
                  filters=channels_1,
                  kernel_size=3,
                  strides=1,
                  padding="same",
                  kernel_initializer=kernel_initializer,
              )(tensor)
              tensor = tf.keras.layers.LeakyReLU(alpha=relu_leakiness)(
                  tensor
              )
              tensor = architectures_progressive_gan.create_conv_layer(
                  use_fan_in_scaled_kernel=use_fan_in_scaled_kernels,
                  filters=channels_2,
                  kernel_size=3,
                  strides=1,
                  padding="same",
                  kernel_initializer=kernel_initializer,
              )(tensor)
              tensor = tf.keras.layers.LeakyReLU(alpha=relu_leakiness)(
                  tensor
              )
              if use_antialiased_bilinear_downsampling:
                  tensor = keras_layers.Blur2D()(tensor)
              tensor = tf.keras.layers.AveragePooling2D()(tensor)
  
              # Adding residual connection and normalizing the variance.
              tensor = (tensor + shortcut) * 1 / math.sqrt(2.0)
  
      tensor = architectures_progressive_gan.create_conv_layer(
          use_fan_in_scaled_kernel=use_fan_in_scaled_kernels,
          filters=downsampling_blocks_num_channels[-1][1],
          kernel_size=3,
          strides=1,
          padding="same",
          kernel_initializer=kernel_initializer,
      )(tensor)
      tensor = tf.keras.layers.LeakyReLU(alpha=relu_leakiness)(tensor)
  
      tensor = architectures_progressive_gan.create_conv_layer(
          use_fan_in_scaled_kernel=use_fan_in_scaled_kernels,
          filters=downsampling_blocks_num_channels[-1][1],
          kernel_size=4,
          strides=1,
          padding="valid",
          kernel_initializer=kernel_initializer,
      )(tensor)
      tensor = tf.keras.layers.LeakyReLU(alpha=relu_leakiness)(tensor)
  
      tensor = architectures_progressive_gan.create_conv_layer(
          use_fan_in_scaled_kernel=use_fan_in_scaled_kernels,
          multiplier=1.0,
          filters=1,
          kernel_size=1,
          kernel_initializer=kernel_initializer,
      )(tensor)
      tensor = tf.keras.layers.Reshape((-1,))(tensor)
  
      return tf.keras.Model(
          inputs=input_tensor, outputs=tensor, name=name
      )
  
file_path: graphics/tensorflow_graphics/projects/gan/architectures_style_gan_v2.py
imports: import math
  from typing import Callable, List, Optional, Sequence, Tuple, Union
  import tensorflow
  from tensorflow_graphics.projects.gan import architectures_progressive_gan
  from tensorflow_graphics.projects.gan import architectures_style_gan
  from tensorflow_graphics.projects.gan import keras_layers
label_desc: Use image node_id 6 for calling a global function with example usage: create_discriminator(downsampling_blocks_num_channels, relu_leakiness, kernel_initializer, use_fan_in_scaled_kernels, use_antialiased_bilinear_downsampling, num_channels, name) and returns: tf