code: def _encode_gif(images, fps):
      """Encodes numpy images into gif string.
  
      Args:
        images: A 4-D `uint8` `np.array` (or a list of 3-D images) of shape
          `[time, height, width, channels]` where `channels` is 1 or 3.
        fps: frames per second of the animation
  
      Returns:
        The encoded gif string.
  
      Raises:
        IOError: If the ffmpeg command returns an error.
      """
      writer = WholeVideoWriter(fps)
      writer.write_multi(images)
      return writer.finish()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import contrib
  import tensorflow.compat.v1
  from tensorflow.python.ops import summary_op_util
label_desc: Use image node_id 14 for calling a global function with example usage: _encode_gif(images, fps) and returns: writer