code: def convert_tensors(exp_dir, out_dir):
      def convert_tensors(tensors_file_path):
          # Exported value is a path to a .npz file, holding tensor values for all
          # points in the entire series.
          if os.path.dirname(tensors_file_path) != _TENSORS_DIR:
              logging.warning(
                  "Skipping invalid tensor file path %r",
                  tensors_file_path,
              )
              return None
          npz = np.load(os.path.join(exp_dir, tensors_file_path))
          return [
              tensor_util.make_tensor_proto(npz[key])
              for key in npz.files
          ]
  
      run_to_series = load_run_to_series(
          os.path.join(exp_dir, _TENSORS_FILE)
      )
      for run, series_list in run_to_series.items():
          w = create_writer_for_run(out_dir, run, "tensors")
          for series in series_list:
              tag = series["tag"]
              summary_metadata = base64.b64decode(
                  series["summary_metadata"]
              )
              tensors = convert_tensors(
                  series["points"]["tensors_file_path"]
              )
              if tensors is None:
                  continue
              if len(tensors) != len(series["points"]["steps"]):
                  logging.warning(
                      "Skipping tag %r in run %r with incomplete tensor data",
                      tag,
                      run,
                  )
              points = zip(
                  series["points"]["steps"],
                  series["points"]["wall_times"],
                  tensors,
              )
              for step, wall_time, tensor in points:
                  e = Event(step=step, wall_time=wall_time)
                  e.summary.value.add(tag=tag, tensor=tensor)
                  e.summary.value[0].metadata.MergeFromString(
                      summary_metadata
                  )
                  w.add_event(e)
          w.close()
  
file_path: tensorboard/tensorboard/tools/convert_tbdev_export.py
imports: import argparse
  import base64
  import collections
  import json
  import logging
  import os
  import re
  import tempfile
  from tensorboard.compat.proto.event_pb2 import Event
  from tensorboard.compat.proto.summary_pb2 import Summary
  from tensorboard.summary.writer.event_file_writer import EventFileWriter
  from tensorboard.util import tensor_util
label_desc: Use image node_id 4 for calling a global function with example usage: convert_tensors(exp_dir, out_dir) and returns: unknown, None