code: def scalar(name, scalar, display_name="", summary_description=""):
      """Outputs a `Summary` protocol buffer containing a single scalar value.
      The generated Summary has a Tensor.proto containing the input Tensor.
      Args:
        name: A name for the generated node. Will also serve as the series name in
          TensorBoard.
        tensor: A real numeric Tensor containing a single value.
        display_name: The title of the plot. If empty string is passed, `name` will be used.
        summary_description: The comprehensive text that will showed by clicking the information icon on TensorBoard.
      Returns:
        A scalar `Tensor` of type `string`. Which contains a `Summary` protobuf.
      Raises:
        ValueError: If tensor has the wrong shape or type.
      """
      name = _clean_tag(name)
      scalar = make_np(scalar)
      assert scalar.squeeze().ndim == 0, "scalar should be 0D"
      scalar = float(scalar.squeeze())
      if display_name == "" and summary_description == "":
          return Summary(
              value=[Summary.Value(tag=name, simple_value=scalar)]
          )
  
      metadata = SummaryMetadata(
          display_name=display_name,
          summary_description=summary_description,
      )
      return Summary(
          value=[
              Summary.Value(
                  tag=name, simple_value=scalar, metadata=metadata
              )
          ]
      )
  
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 4 for calling a global function with example usage: scalar(name, scalar, display_name, summary_description) and returns: Summary, Summary