code: def write_summary(summary_pb):
      tf.compat.v1.enable_eager_execution()
      writer = tf.compat.v2.summary.create_file_writer(FLAGS.logdir)
      with writer.as_default():
          if hasattr(tf.compat.v2.summary.experimental, "write_raw_pb"):
              tf.compat.v2.summary.experimental.write_raw_pb(
                  summary_pb.SerializeToString(), step=0
              )
          else:
              # TODO(https://github.com/tensorflow/tensorboard/issues/2109): remove the
              #   fallback to import_event().
              event = tf.compat.v1.Event(summary=summary_pb)
              tf.compat.v2.summary.import_event(
                  tf.constant(
                      event.SerializeToString(), dtype=tf.string
                  )
              )
          # The following may not be required since the context manager may
          # already flush on __exit__, but it doesn't hurt to do it here, as well.
          tf.compat.v2.summary.flush()
  
file_path: tensorboard/tensorboard/plugins/hparams/hparams_util.py
imports: import getpass
  import time
  from absl import app
  from absl import flags
  from google.protobuf import struct_pb2
  from google.protobuf import text_format
  import tensorflow
  from tensorboard.plugins.hparams import api_pb2
  from tensorboard.plugins.hparams import hparams_util_pb2
  from tensorboard.plugins.hparams import summary
label_desc: Use image node_id 6 for calling a global function with example usage: write_summary(summary_pb) without return types