code: def _add_embedding_config(
      file_path, data_dir, has_metadata=False, label_img_shape=None
  ):
      """Creates a config file used by the embedding projector.
      Adapted from the TensorFlow function `visualize_embeddings()` at
      https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/tensorboard/plugins/projector/__init__.py
      """
      with open(
          os.path.join(file_path, "projector_config.pbtxt"), "a"
      ) as f:
          s = "embeddings {\n"
          s += 'tensor_name: "{}"\n'.format(data_dir)
          s += 'tensor_path: "{}"\n'.format(
              os.path.join(data_dir, "tensors.tsv")
          )
          if has_metadata:
              s += 'metadata_path: "{}"\n'.format(
                  os.path.join(data_dir, "metadata.tsv")
              )
          if label_img_shape is not None:
              if len(label_img_shape) != 4:
                  logging.warning(
                      "expected 4D sprite image in the format NCHW, while received image"
                      " ndim=%d, skipping saving sprite"
                      " image info",
                      len(label_img_shape),
                  )
              else:
                  s += "sprite {\n"
                  s += 'image_path: "{}"\n'.format(
                      os.path.join(data_dir, "sprite.png")
                  )
                  s += "single_image_dim: {}\n".format(
                      label_img_shape[3]
                  )
                  s += "single_image_dim: {}\n".format(
                      label_img_shape[2]
                  )
                  s += "}\n"
          s += "}\n"
          f.write(s)
  
file_path: mxboard/python/mxboard/utils.py
imports: from __future__ import absolute_import
  import os
  import logging
  import numpy
  from mxnet.ndarray import NDArray, op
  from mxnet.ndarray import ndarray
  from mxnet.context import current_context
label_desc: Use image node_id 10 for calling a global function with example usage: _add_embedding_config(file_path, data_dir, has_metadata, label_img_shape) without return types