code: def _WriteScalarSummaries(self, data, subdirs=("",)):
      # Writes data to a tempfile in subdirs, and returns generator for the data.
      # If subdirs is given, writes data identically to all subdirectories.
      for subdir_ in subdirs:
          subdir = os.path.join(self.logdir, subdir_)
          self._MakeDirectoryIfNotExists(subdir)
  
          with test_util.FileWriterCache.get(subdir) as sw:
              for datum in data:
                  summary = summary_pb2.Summary()
                  if "simple_value" in datum:
                      summary.value.add(
                          tag=datum["tag"],
                          simple_value=datum["simple_value"],
                      )
                      sw.add_summary(summary, global_step=datum["step"])
                  elif "histo" in datum:
                      summary.value.add(
                          tag=datum["tag"],
                          histo=summary_pb2.HistogramProto(),
                      )
                      sw.add_summary(summary, global_step=datum["step"])
                  elif "session_log" in datum:
                      sw.add_session_log(
                          datum["session_log"],
                          global_step=datum["step"],
                      )
  
file_path: tensorboard/tensorboard/backend/event_processing/event_file_inspector_test.py
imports: import os
  import shutil
  import tensorflow
  from tensorboard.backend.event_processing import event_file_inspector
  from tensorboard.compat.proto import event_pb2
  from tensorboard.compat.proto import summary_pb2
  from tensorboard.util import test_util
label_desc: Use image node_id 4 for calling the EventFileInspectorTest obj's underlying member method code with example usage: obj._WriteScalarSummaries(data, subdirs) without return types