code: def interpolations_to_summary(sample_ind, interpolations, first_frame,
                                last_frame, hparams, decode_hp):
    
    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
docs: 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.