code: def write_embedding(log_dir):
      """Writes embedding data and projector configuration to the logdir."""
      metadata_filename = "metadata.tsv"
      tensor_filename = "tensor.tsv"
  
      labels = ANIMALS.strip().splitlines()
      labels_to_tensors = {
          label: tensor_for_label(label) for label in labels
      }
      os.makedirs(log_dir, exist_ok=True)
      with open(os.path.join(log_dir, metadata_filename), "w") as f:
          for label in labels_to_tensors:
              f.write("{}\n".format(label))
      with open(os.path.join(log_dir, tensor_filename), "w") as f:
          for tensor in labels_to_tensors.values():
              f.write("{}\n".format("\t".join(str(x) for x in tensor)))
  
      config = projector.ProjectorConfig()
      embedding = config.embeddings.add()
      embedding.metadata_path = metadata_filename
      embedding.tensor_path = tensor_filename
      projector.visualize_embeddings(log_dir, config)
  
file_path: tensorboard/tensorboard/plugins/projector/projector_demo.py
imports: import os
  import string
  from absl import app
  from absl import flags
  from tensorboard.plugins import projector
label_desc: Use image node_id 2 for calling a global function with example usage: write_embedding(log_dir) without return types