class_docstr: Saves data in event and summary protos for tensorboard.
class_docstr_tok: ["Saves","data","in","event","and","summary","protos","for","tensorboard","."]
docstr: Saves RGB image summary from np.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
docstr_tok: ["Saves","RGB","image","summary","from","np.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"]
code: def image(self, tag, image, step=None):
      """Saves RGB image summary from np.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
      """
      image = np.array(image)
      if step is None:
          step = self._step
      else:
          self._step = step
      if len(np.shape(image)) == 2:
          image = image[:, :, np.newaxis]
      if np.shape(image)[-1] == 1:
          image = np.repeat(image, 3, axis=-1)
      image_strio = io.BytesIO()
      plt.imsave(image_strio, image, format="png")
      image_summary = tf.compat.v1.Summary.Image(
          encoded_image_string=image_strio.getvalue(),
          colorspace=3,
          height=image.shape[0],
          width=image.shape[1],
      )
      summary = tf.compat.v1.Summary(
          value=[
              tf.compat.v1.Summary.Value(tag=tag, image=image_summary)
          ]
      )
      self.add_summary(summary, step)
  
imports: import io
  import struct
  import time
  import warnings
  import wave
  import matplotlib
  import matplotlib.pyplot
  import numpy
  import tensorflow
  from tensorflow.core.util import event_pb2
  from tensorflow.python.summary.writer.event_file_writer import EventFileWriter
label_desc: Use image node_id 7 for calling the SummaryWriter obj's underlying member method code with example usage: obj.image(tag, image, step) without return types