code: def blend_images(x, progress, resolution_schedule, num_blocks):
      """Blends images of different resolutions according to `progress`.
  
      When training `progress` is at a stable stage for resolution r, returns
      image `x` downscaled to resolution r and then upscaled to `final_resolutions`,
      call it x'(r).
  
      Otherwise when training `progress` is at a transition stage from resolution
      r to 2r, returns a linear combination of x'(r) and x'(2r).
  
      Args:
        x: An image `Tensor` of NHWC format with resolution `final_resolutions`.
        progress: A scalar float `Tensor` of training progress.
        resolution_schedule: An object of `ResolutionSchedule`.
        num_blocks: An integer of number of blocks.
  
      Returns:
        An image `Tensor` which is a blend of images of different resolutions.
      """
      x_blend = []
      for block_id in range(1, num_blocks + 1):
          alpha = _generator_alpha(block_id, progress)
          scale = resolution_schedule.scale_factor(block_id)
          rescaled_x = resolution_schedule.upscale(
              resolution_schedule.downscale(x, scale), scale
          )
          x_blend.append(alpha * rescaled_x)
      return tf.add_n(x_blend)
  
imports: import math
  from magenta.models.gansynth.lib import layers
  import tensorflow.compat.v1
  import tf_slim
label_desc: Use image node_id 7 for calling a global function with example usage: blend_images(x, progress, resolution_schedule, num_blocks) and returns: tf