code: def G_style(
      latents_in,  # First input: Latent vectors (Z) [minibatch, latent_size].
      labels_in,  # Second input: Conditioning labels [minibatch, label_size].
      truncation_psi=0.7,  # Style strength multiplier for the truncation trick. None = disable.
      truncation_cutoff=8,  # Number of layers for which to apply the truncation trick. None = disable.
      truncation_psi_val=None,  # Value for truncation_psi to use during validation.
      truncation_cutoff_val=None,  # Value for truncation_cutoff to use during validation.
      dlatent_avg_beta=0.995,  # Decay for tracking the moving average of W during training. None = disable.
      style_mixing_prob=0.9,  # Probability of mixing styles during training. None = disable.
      is_training=False,  # Network is under training? Enables and disables specific features.
      is_validation=False,  # Network is under validation? Chooses which value to use for truncation_psi.
      is_template_graph=False,  # True = template graph constructed by the Network class, False = actual evaluation.
      components=dnnlib.EasyDict(),  # Container for sub-networks. Retained between calls.
      **kwargs,
  ):  # Arguments for sub-networks (G_mapping and G_synthesis).
      # Validate arguments.
      assert not is_training or not is_validation
      assert isinstance(components, dnnlib.EasyDict)
      if is_validation:
          truncation_psi = truncation_psi_val
          truncation_cutoff = truncation_cutoff_val
      if is_training or (
          truncation_psi is not None
          and not tflib.is_tf_expression(truncation_psi)
          and truncation_psi == 1
      ):
          truncation_psi = None
      if is_training or (
          truncation_cutoff is not None
          and not tflib.is_tf_expression(truncation_cutoff)
          and truncation_cutoff <= 0
      ):
          truncation_cutoff = None
      if not is_training or (
          dlatent_avg_beta is not None
          and not tflib.is_tf_expression(dlatent_avg_beta)
          and dlatent_avg_beta == 1
      ):
          dlatent_avg_beta = None
      if not is_training or (
          style_mixing_prob is not None
          and not tflib.is_tf_expression(style_mixing_prob)
          and style_mixing_prob <= 0
      ):
          style_mixing_prob = None
  
      # Setup components.
      if "synthesis" not in components:
          components.synthesis = tflib.Network(
              "G_synthesis", func_name=G_synthesis, **kwargs
          )
      num_layers = components.synthesis.input_shape[1]
      dlatent_size = components.synthesis.input_shape[2]
      if "mapping" not in components:
          components.mapping = tflib.Network(
              "G_mapping",
              func_name=G_mapping,
              dlatent_broadcast=num_layers,
              **kwargs,
          )
  
      # Setup variables.
      lod_in = tf.get_variable(
          "lod", initializer=np.float32(0), trainable=False
      )
      dlatent_avg = tf.get_variable(
          "dlatent_avg",
          shape=[dlatent_size],
          initializer=tf.initializers.zeros(),
          trainable=False,
      )
  
      # Evaluate mapping network.
      dlatents = components.mapping.get_output_for(
          latents_in, labels_in, **kwargs
      )
  
      # Update moving average of W.
      if dlatent_avg_beta is not None:
          with tf.variable_scope("DlatentAvg"):
              batch_avg = tf.reduce_mean(dlatents[:, 0], axis=0)
              update_op = tf.assign(
                  dlatent_avg,
                  tflib.lerp(batch_avg, dlatent_avg, dlatent_avg_beta),
              )
              with tf.control_dependencies([update_op]):
                  dlatents = tf.identity(dlatents)
  
      # Perform style mixing regularization.
      if style_mixing_prob is not None:
          with tf.name_scope("StyleMix"):
              latents2 = tf.random_normal(tf.shape(latents_in))
              dlatents2 = components.mapping.get_output_for(
                  latents2, labels_in, **kwargs
              )
              layer_idx = np.arange(num_layers)[
                  np.newaxis, :, np.newaxis
              ]
              cur_layers = num_layers - tf.cast(lod_in, tf.int32) * 2
              mixing_cutoff = tf.cond(
                  tf.random_uniform([], 0.0, 1.0) < style_mixing_prob,
                  lambda: tf.random_uniform(
                      [], 1, cur_layers, dtype=tf.int32
                  ),
                  lambda: cur_layers,
              )
              dlatents = tf.where(
                  tf.broadcast_to(
                      layer_idx < mixing_cutoff, tf.shape(dlatents)
                  ),
                  dlatents,
                  dlatents2,
              )
  
      # Apply truncation trick.
      if truncation_psi is not None and truncation_cutoff is not None:
          with tf.variable_scope("Truncation"):
              layer_idx = np.arange(num_layers)[
                  np.newaxis, :, np.newaxis
              ]
              ones = np.ones(layer_idx.shape, dtype=np.float32)
              coefs = tf.where(
                  layer_idx < truncation_cutoff,
                  truncation_psi * ones,
                  ones,
              )
              dlatents = tflib.lerp(dlatent_avg, dlatents, coefs)
  
      # Evaluate synthesis network.
      with tf.control_dependencies(
          [tf.assign(components.synthesis.find_var("lod"), lod_in)]
      ):
          images_out = components.synthesis.get_output_for(
              dlatents, force_clean_graph=is_template_graph, **kwargs
          )
      return tf.identity(images_out, name="images_out")
  
imports: import numpy
  import tensorflow
  import dnnlib
  import dnnlib.tflib
label_desc: Use image node_id 19 for calling a global function with example usage: G_style(latents_in, labels_in, truncation_psi, truncation_cutoff, truncation_psi_val, truncation_cutoff_val, dlatent_avg_beta, style_mixing_prob, is_training, is_validation, is_template_graph, components) and returns: tf