code: def write_scalar_event(self, *args, **kwargs):
      kwargs.setdefault("step", 1)
      # Hack to extract current scope since there's no direct API for it.
      with tf.name_scope("_") as temp_scope:
          scope = temp_scope.rstrip("/_")
  
      @tf2.function
      def graph_fn():
          # Recreate the active scope inside the defun since it won't propagate.
          with tf.name_scope(scope):
              summary.scalar(*args, **kwargs)
  
      writer = tf2.summary.create_file_writer(self.get_temp_dir())
      with writer.as_default():
          graph_fn()
      writer.close()
  
imports: import glob
  import os
  import numpy
  import tensorflow
  from tensorboard.compat import tf2
  from tensorboard.compat.proto import summary_pb2
  from tensorboard.plugins.scalar import metadata
  from tensorboard.plugins.scalar import summary
  from tensorboard.util import tensor_util
label_desc: Use image node_id 1 for calling the SummaryV2OpGraphTest obj's underlying member method code with example usage: obj.write_scalar_event() without return types