code: def interpolations_to_summary(
      sample_ind,
      interpolations,
      first_frame,
      last_frame,
      hparams,
      decode_hp,
  ):
      """Converts interpolated frames into tf summaries.
  
      The summaries consists of:
        1. Image summary corresponding to the first frame.
        2. Image summary corresponding to the last frame.
        3. The interpolated frames as a gif summary.
  
      Args:
        sample_ind: int
        interpolations: Numpy array, shape=(num_interp, H, W, 3)
        first_frame: Numpy array, shape=(HWC)
        last_frame: Numpy array, shape=(HWC)
        hparams: HParams, train hparams
        decode_hp: HParams, decode hparams
      Returns:
        summaries: list of tf Summary Values.
      """
      parent_tag = "sample_%d" % sample_ind
      frame_shape = hparams.problem.frame_shape
      interp_shape = [
          hparams.batch_size,
          decode_hp.num_interp,
      ] + frame_shape
      interpolations = np.reshape(interpolations, interp_shape)
      interp_tag = "%s/interp/%s" % (
          parent_tag,
          decode_hp.channel_interp,
      )
      if decode_hp.channel_interp == "ranked":
          interp_tag = "%s/rank_%d" % (
              interp_tag,
              decode_hp.rank_interp,
          )
      summaries, _ = common_video.py_gif_summary(
          interp_tag,
          interpolations,
          return_summary_value=True,
          max_outputs=decode_hp.max_display_outputs,
          fps=decode_hp.frames_per_second,
      )
  
      if decode_hp.save_frames:
          first_frame_summ = image_utils.image_to_tf_summary_value(
              first_frame, "%s/first" % parent_tag
          )
          last_frame_summ = image_utils.image_to_tf_summary_value(
              last_frame, "%s/last" % parent_tag
          )
          summaries.append(first_frame_summ)
          summaries.append(last_frame_summ)
      return summaries
  
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 7 for calling a global function with example usage: interpolations_to_summary(sample_ind, interpolations, first_frame, last_frame, hparams, decode_hp) and returns: summaries