code: def _generator_alpha(block_id, progress):
      """Returns the block output parameter for the generator network.
  
      The generator has N blocks with `block_id` = 1,2,...,N. Each block
      block_id outputs a fake data output(block_id). The generator output is a
      linear combination of all block outputs, i.e.
      SUM_block_id(output(block_id) * alpha(block_id, progress)) where
      alpha(block_id, progress) = _generator_alpha(block_id, progress). Note it
      garantees that SUM_block_id(alpha(block_id, progress)) = 1 for any progress.
  
      With a fixed block_id, the plot of alpha(block_id, progress) against progress
      is a 'triangle' with its peak at (block_id - 1, 1).
  
      Args:
        block_id: An integer of generator block id.
        progress: A scalar float `Tensor` of training progress.
  
      Returns:
        A scalar float `Tensor` of block output parameter.
      """
      return tf.maximum(
          0.0,
          tf.minimum(progress - (block_id - 2), block_id - progress),
      )
  
imports: import math
  from magenta.models.gansynth.lib import layers
  import tensorflow.compat.v1
  import tf_slim
label_desc: Use image node_id 5 for calling a global function with example usage: _generator_alpha(block_id, progress) and returns: tf