code: def write_scalars(step):
      x = tf.cast(step, dtype=tf.float32)
      with tf.name_scope("loss"):
          # Specify 2 different loss values, each tagged differently.
          tf.summary.scalar("foo", tf.pow(0.9, x), step=step)
          tf.summary.scalar("bar", tf.pow(0.85, x + 2), step=step)
  
          # Log metric baz as well as upper and lower bounds for a margin chart.
          middle_baz_value = x + 4 * tf.random.uniform([]) - 2
          tf.summary.scalar("baz", middle_baz_value, step=step)
          tf.summary.scalar(
              "baz_lower",
              middle_baz_value - 6.42 - tf.random.uniform([]),
              step=step,
          )
          tf.summary.scalar(
              "baz_upper",
              middle_baz_value + 6.42 + tf.random.uniform([]),
              step=step,
          )
      with tf.name_scope("trigFunctions"):
          tf.summary.scalar("cosine", tf.cos(x), step=step)
          tf.summary.scalar("sine", tf.sin(x), step=step)
          tf.summary.scalar("tangent", tf.tan(x), step=step)
  
file_path: tensorboard/tensorboard/plugins/custom_scalar/custom_scalar_demo.py
imports: from absl import app
  import tensorflow
  from tensorboard.plugins.custom_scalar import summary
  from tensorboard.plugins.custom_scalar import layout_pb2
label_desc: Use image node_id 2 for calling a global function with example usage: write_scalars(step) without return types