code: def compute_progress(
      current_image_id,
      stable_stage_num_images,
      transition_stage_num_images,
      num_blocks,
  ):
      """Computes the training progress.
  
      The training alternates between stable phase and transition phase.
      The `progress` indicates the training progress, i.e. the training is at
      - a stable phase p if progress = p
      - a transition stage between p and p + 1 if progress = p + fraction
      where p = 0,1,2.,...
  
      Note the max value of progress is `num_blocks` - 1.
  
      In terms of LOD (of the original implementation):
      progress = `num_blocks` - 1 - LOD
  
      Args:
        current_image_id: An scalar integer `Tensor` of the current image id, count
            from 0.
        stable_stage_num_images: An integer representing the number of images in
            each stable stage.
        transition_stage_num_images: An integer representing the number of images in
            each transition stage.
        num_blocks: Number of network blocks.
  
      Returns:
        A scalar float `Tensor` of the training progress.
      """
      # Note when current_image_id >= min_total_num_images - 1 (which means we
      # are already at the highest resolution), we want to keep progress constant.
      # Therefore, cap current_image_id here.
      capped_current_image_id = tf.minimum(
          current_image_id,
          min_total_num_images(
              stable_stage_num_images,
              transition_stage_num_images,
              num_blocks,
          )
          - 1,
      )
  
      stage_num_images = (
          stable_stage_num_images + transition_stage_num_images
      )
      progress_integer = tf.floordiv(
          capped_current_image_id, stage_num_images
      )
      progress_fraction = tf.maximum(
          0.0,
          tf.to_float(
              tf.mod(capped_current_image_id, stage_num_images)
              - stable_stage_num_images
          )
          / tf.to_float(transition_stage_num_images),
      )
      return tf.to_float(progress_integer) + progress_fraction
  
imports: import math
  from magenta.models.gansynth.lib import layers
  import tensorflow.compat.v1
  import tf_slim
label_desc: Use image node_id 3 for calling a global function with example usage: compute_progress(current_image_id, stable_stage_num_images, transition_stage_num_images, num_blocks) and returns: unknown