code: def image(self, tag, image, step=None):
      
      image = onp.array(image)
      if step is None:
        step = self._step
      else:
        self._step = step
      if len(onp.shape(image)) == 2:
        image = image[:, :, onp.newaxis]
      if onp.shape(image)[-1] == 1:
        image = onp.repeat(image, 3, axis=-1)
      image_strio = io.BytesIO()
      plt.imsave(image_strio, image, format='png')
      image_summary = Summary.Image(
          encoded_image_string=image_strio.getvalue(),
          colorspace=3,
          height=image.shape[0],
          width=image.shape[1])
      summary = Summary(value=[Summary.Value(tag=tag, image=image_summary)])
      self.add_summary(summary, step)
docs: Saves RGB image summary from onp.ndarray [H,W], [H,W,1], or [H,W,3].
  
      Args:
        tag: str: label for this data
        image: ndarray: [H,W], [H,W,1], [H,W,3] save image in greyscale or colors/
        step: int: training step