code: def interpolate(features, hparams, decode_hp):
      """Interpolate between the first input frame and last target frame.
  
      Args:
        features: dict of tensors
        hparams: HParams, training hparams.
        decode_hp: HParams, decode hparams.
      Returns:
        images: interpolated images, 4-D Tensor, shape=(num_interp, H, W, C)
        first_frame: image, 3-D Tensor, shape=(1, H, W, C)
        last_frame: image, 3-D Tensor, shape=(1, H, W, C)
      """
      inputs, targets = features["inputs"], features["targets"]
      inputs = tf.unstack(inputs, axis=1)
      targets = tf.unstack(targets, axis=1)
      coeffs = np.linspace(0.0, 1.0, decode_hp.num_interp)
  
      # (X_1, X_t) -> (z_1, z_t)
      first_frame, last_frame = inputs[0], targets[-1]
      first_top_z, first_level_eps = frame_to_latents(
          first_frame, hparams
      )
      last_top_z, last_level_eps = frame_to_latents(last_frame, hparams)
  
      # Interpolate latents at all levels.
      first_lats = first_level_eps + [first_top_z]
      last_lats = last_level_eps + [last_top_z]
      interp_lats = []
      lat_iterator = enumerate(zip(first_lats, last_lats))
      for level_ind, (first_lat, last_lat) in lat_iterator:
          if level_ind in decode_hp.level_interp:
              if decode_hp.channel_interp == "all":
                  interp_lat = glow_ops.linear_interpolate(
                      first_lat, last_lat, coeffs
                  )
              else:
                  interp_lat = glow_ops.linear_interpolate_rank(
                      first_lat, last_lat, coeffs, decode_hp.rank_interp
                  )
          else:
              interp_lat = tf.tile(
                  first_lat, [decode_hp.num_interp, 1, 1, 1]
              )
          interp_lats.append(interp_lat)
  
      level_eps_interp = interp_lats[: hparams.n_levels - 1]
      z_top_interp = interp_lats[-1]
      images = latents_to_frames(
          z_top_interp, level_eps_interp, hparams
      )
      return images, first_frame, last_frame
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl import flags
  import numpy
  from six.moves import zip
  from tensor2tensor.bin import t2t_trainer
  from tensor2tensor.data_generators import image_utils
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import common_video
  from tensor2tensor.models.research import glow_ops
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import decoding
  from tensor2tensor.utils import trainer_lib
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 5 for calling a global function with example usage: interpolate(features, hparams, decode_hp) and returns: images,  first_frame,  last_frame