class_docstr: This class is adapted with modifications in support of the MXNet NDArray types from
  https://github.com/lanpa/tensorboard-pytorch/blob/master/tensorboardX/writer.py.
  The `SummaryWriter` class provides a high-level api to create an event file in a
  given directory and add summaries and events to it. This class writes data to the
  event file asynchronously.
  This class is a wrapper of the FileWriter class. It's recommended that users use
  the APIs of this class to log MXNet data for visualization as they are directly compatible with
  the MXNet data types.
  
  Examples
  --------
  >>> data = mx.nd.random.uniform(size=(10, 10))
  >>> with SummaryWriter(logdir='logs') as sw:
  >>>     sw.add_histogram(tag='my_hist', values=data, global_step=0, bins=100)
docstr: Adds scalar data to the event file.
  
  Parameters
  ----------
      tag : str
          Name for the scalar plot.
      value : float, tuple, list, or dict
          If value is a float, the corresponding curve would have no name attached in the
          plot.
          If value is a tuple or list, it must have two elements with the first one
          representing the name of the value and the second one as the float value. The
          name of the value will be attached to the corresponding curve in the plot. This
          is useful when users want to draw multiple curves in the same plot. It internally
          calls `_add_scalars`.
          If value is a dict, it's a mapping from strs to float values, with strs
          representing the names of the float values. This is convenient when users want
          to log a collection of float values with different names for visualizing them in
          the same plot without repeatedly calling `add_scalar` for each value. It internally
          calls `_add_scalars`.
      global_step : int
          Global step value to record.
  
  Examples
  --------
  >>> import numpy as np
  >>> from mxboard import SummaryWriter
  
  >>> xs = np.arange(start=0, stop=2 * np.pi, step=0.01)
  >>> y_sin = np.sin(xs)
  >>> y_cos = np.cos(xs)
  >>> y_exp_sin = np.exp(y_sin)
  >>> y_exp_cos = np.exp(y_cos)
  >>> y_sin2 = y_sin * y_sin
  >>> with SummaryWriter(logdir='./logs') as sw:
  >>>     for x, y1, y2, y3, y4, y5 in zip(xs, y_sin, y_cos, y_exp_sin, y_exp_cos, y_sin2):
  >>>         sw.add_scalar('curves', {'sin': y1, 'cos': y2}, x * 100)
  >>>         sw.add_scalar('curves', ('exp(sin)', y3), x * 100)
  >>>         sw.add_scalar('curves', ['exp(cos)', y4], x * 100)
  >>>         sw.add_scalar('curves', y5, x * 100)
docstr_tok: ["Adds","scalar","data","to","the","event","file",".","Parameters","--","--","--","--","--","tag",":","str","Name","for","the","scalar","plot",".","value",":","float",",","tuple",",","list",",","or","dict","If","value","is","a","float",",","the","corresponding","curve","would","have","no","name","attached","in","the","plot",".","If","value","is","a","tuple","or","list",",","it","must","have","two","elements","with","the","first","one","representing","the","name","of","the","value","and","the","second","one","as","the","float","value",".","The","name","of","the","value","will","be","attached","to","the","corresponding","curve","in","the","plot",".","This","is","useful","when","users","want","to","draw","multiple","curves","in","the","same","plot",".","It","internally","calls","`","_add_scalars","`",".","If","value","is","a","dict",",","it","'s","a","mapping","from","strs","to","float","values",",","with","strs","representing","the","names","of","the","float","values",".","This","is","convenient","when","users","want","to","log","a","collection","of","float","values","with","different","names","for","visualizing","them","in","the","same","plot","without","repeatedly","calling","`","add_scalar","`","for","each","value",".","It","internally","calls","`","_add_scalars","`",".","global_step",":","int","Global","step","value","to","record",".","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","from","mxboard","import","SummaryWriter",">",">",">","xs","=","np.arange","(","start=0",",","stop=2","*","np.pi",",","step=0.01",")",">",">",">","y_sin","=","np.sin","(","xs",")",">",">",">","y_cos","=","np.cos","(","xs",")",">",">",">","y_exp_sin","=","np.exp","(","y_sin",")",">",">",">","y_exp_cos","=","np.exp","(","y_cos",")",">",">",">","y_sin2","=","y_sin","*","y_sin",">",">",">","with","SummaryWriter","(","logdir='.\/logs","'",")","as","sw",":",">",">",">","for","x",",","y1",",","y2",",","y3",",","y4",",","y5","in","zip","(","xs",",","y_sin",",","y_cos",",","y_exp_sin",",","y_exp_cos",",","y_sin2",")",":",">",">",">","sw.add_scalar","(","'curves","'",",","{","'sin","'",":","y1",",","'cos","'",":","y2","}",",","x","*","100",")",">",">",">","sw.add_scalar","(","'curves","'",",","(","'exp","(","sin",")","'",",","y3",")",",","x","*","100",")",">",">",">","sw.add_scalar","(","'curves","'",",","[","'exp","(","cos",")","'",",","y4","]",",","x","*","100",")",">",">",">","sw.add_scalar","(","'curves","'",",","y5",",","x","*","100",")"]
code: def add_scalar(self, tag, value, global_step=None):
      """Adds scalar data to the event file.
  
      Parameters
      ----------
          tag : str
              Name for the scalar plot.
          value : float, tuple, list, or dict
              If value is a float, the corresponding curve would have no name attached in the
              plot.
              If value is a tuple or list, it must have two elements with the first one
              representing the name of the value and the second one as the float value. The
              name of the value will be attached to the corresponding curve in the plot. This
              is useful when users want to draw multiple curves in the same plot. It internally
              calls `_add_scalars`.
              If value is a dict, it's a mapping from strs to float values, with strs
              representing the names of the float values. This is convenient when users want
              to log a collection of float values with different names for visualizing them in
              the same plot without repeatedly calling `add_scalar` for each value. It internally
              calls `_add_scalars`.
          global_step : int
              Global step value to record.
  
      Examples
      --------
      >>> import numpy as np
      >>> from mxboard import SummaryWriter
  
      >>> xs = np.arange(start=0, stop=2 * np.pi, step=0.01)
      >>> y_sin = np.sin(xs)
      >>> y_cos = np.cos(xs)
      >>> y_exp_sin = np.exp(y_sin)
      >>> y_exp_cos = np.exp(y_cos)
      >>> y_sin2 = y_sin * y_sin
      >>> with SummaryWriter(logdir='./logs') as sw:
      >>>     for x, y1, y2, y3, y4, y5 in zip(xs, y_sin, y_cos, y_exp_sin, y_exp_cos, y_sin2):
      >>>         sw.add_scalar('curves', {'sin': y1, 'cos': y2}, x * 100)
      >>>         sw.add_scalar('curves', ('exp(sin)', y3), x * 100)
      >>>         sw.add_scalar('curves', ['exp(cos)', y4], x * 100)
      >>>         sw.add_scalar('curves', y5, x * 100)
      """
      if isinstance(value, (tuple, list, dict)):
          if isinstance(value, (tuple, list)):
              if len(value) != 2:
                  raise ValueError(
                      "expected two elements in value, while received %d"
                      % len(value)
                  )
              value = {value[0]: value[1]}
          self._add_scalars(tag, value, global_step)
      else:
          self._file_writer.add_summary(
              scalar_summary(tag, value), global_step
          )
          self._append_to_scalar_dict(
              self.get_logdir() + "/" + tag,
              value,
              global_step,
              time.time(),
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import time
  import json
  import os
  import logging
  from .proto import event_pb2
  from .proto import summary_pb2
  from .event_file_writer import EventFileWriter
  from .summary import scalar_summary, histogram_summary, image_summary, audio_summary
  from .summary import text_summary, pr_curve_summary, _net2pb
  from .utils import _save_embedding_tsv, _make_sprite_image, _make_metadata_tsv
  from .utils import _add_embedding_config, _make_numpy_array, _get_embedding_dir
  from .utils import _is_2D_matrix
label_desc: Use image node_id 7 for calling the SummaryWriter obj's underlying member method code with example usage: obj.add_scalar(tag, value, global_step) without return types