code: def image(tag, tensor, rescale=1, dataformats="CHW"):
      """Outputs a `Summary` protocol buffer with images.
      The summary has up to `max_images` summary values containing images. The
      images are built from `tensor` which must be 3-D with shape `[height, width,
      channels]` and where `channels` can be:
      *  1: `tensor` is interpreted as Grayscale.
      *  3: `tensor` is interpreted as RGB.
      *  4: `tensor` is interpreted as RGBA.
  
      Args:
        tag: A name for the generated node. Will also serve as a series name in
          TensorBoard.
        tensor: A 3-D `uint8` or `float32` `Tensor` of shape `[height, width,
          channels]` where `channels` is 1, 3, or 4.
          'tensor' can either have values in [0, 1] (float32) or [0, 255] (uint8).
          The image() function will scale the image values to [0, 255] by applying
          a scale factor of either 1 (uint8) or 255 (float32).
      Returns:
        A scalar `Tensor` of type `string`. The serialized `Summary` protocol
        buffer.
      """
      tag = _clean_tag(tag)
      tensor = make_np(tensor)
      tensor = convert_to_HWC(tensor, dataformats)
      # Do not assume that user passes in values in [0, 255], use data type to detect
      if tensor.dtype != np.uint8:
          tensor = (tensor * 255.0).astype(np.uint8)
  
      image = make_image(tensor, rescale=rescale)
      return Summary(value=[Summary.Value(tag=tag, image=image)])
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import numpy
  import os
  import re
  from .proto.summary_pb2 import Summary
  from .proto.summary_pb2 import HistogramProto
  from .proto.summary_pb2 import SummaryMetadata
  from .proto.tensor_pb2 import TensorProto
  from .proto.tensor_shape_pb2 import TensorShapeProto
  from .proto.plugin_pr_curve_pb2 import PrCurvePluginData
  from .proto.plugin_text_pb2 import TextPluginData
  from .proto.plugin_mesh_pb2 import MeshPluginData
  from .proto import layout_pb2
  from .x2num import make_np
  from .utils import _prepare_video, convert_to_HWC, convert_to_NTCHW
label_desc: Use image node_id 8 for calling a global function with example usage: image(tag, tensor, rescale, dataformats) and returns: Summary