code: def create_style_based_generator(
      latent_code_dimension: int = 128,
      upsampling_blocks_num_channels: Sequence[int] = (
          512,
          256,
          128,
          64,
      ),
      relu_leakiness: float = 0.2,
      use_bilinear_upsampling: bool = True,
      normalize_latent_code: bool = True,
      use_noise_inputs: bool = False,
      name: str = "style_gan_v2_generator",
  ) -> Tuple[tf.keras.Model, tf.keras.Model, tf.keras.Model]:
      """Creates a Keras model for the style based generator network architecture.
  
      This architecture is implemented accodring to "Analyzing and Improving the
      Image Quality of StyleGAN"
      https://arxiv.org/pdf/1912.04958.pdf
  
      Args:
        latent_code_dimension: The number of dimensions in the latent code.
        upsampling_blocks_num_channels: The number of channels for each upsampling
          block. This argument also determines how many upsampling blocks are added.
        relu_leakiness: Slope of the negative part of the leaky relu.
        use_bilinear_upsampling: If true bilinear upsampling is used.
        normalize_latent_code: If true the latent code is normalized to unit length
          before feeding it to the network.
        use_noise_inputs: If the model takes noise as input, if false noise is
          sampled randomly.
        name: The name of the Keras model.
  
      Returns:
         Three Keras models. The whole generator, only the mapping network and only
         the synthesis network.
      """
      mapping_network = architectures_style_gan.create_mapping_network(
          latent_code_dimension=latent_code_dimension,
          normalize_latent_code=normalize_latent_code,
          relu_leakiness=relu_leakiness,
      )
      synthesis_network = create_synthesis_network(
          latent_code_dimension=latent_code_dimension,
          upsampling_blocks_num_channels=upsampling_blocks_num_channels,
          relu_leakiness=relu_leakiness,
          use_bilinear_upsampling=use_bilinear_upsampling,
          use_noise_inputs=use_noise_inputs,
      )
  
      input_tensor = tf.keras.Input(shape=(latent_code_dimension,))
      mapped_latent_code = mapping_network(input_tensor)
  
      if use_noise_inputs:
          noise_inputs = _create_noise_inputs(
              len(upsampling_blocks_num_channels)
          )
          synthesis_inputs = [mapped_latent_code] + noise_inputs
          generator_inputs = [input_tensor] + noise_inputs
      else:
          synthesis_inputs = mapped_latent_code
          generator_inputs = input_tensor
  
      generated_images = synthesis_network(synthesis_inputs)
      generator = tf.keras.Model(
          inputs=generator_inputs, outputs=generated_images, name=name
      )
  
      return generator, mapping_network, synthesis_network
  
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 5 for calling a global function with example usage: create_style_based_generator(latent_code_dimension, upsampling_blocks_num_channels, relu_leakiness, use_bilinear_upsampling, normalize_latent_code, use_noise_inputs, name) and returns: generator,  mapping_network,  synthesis_network