class_docstr: Writes entries directly to event files in the log_dir to be consumed by TensorBoard.
  
  The `SummaryWriter` class provides a high-level API to create an event file
  in a given directory and add summaries and events to it. The class updates the
  file contents asynchronously. This allows a training program to call methods
  to add data to the file directly from the training loop, without slowing down
  training.
class_docstr_tok: ["Writes","entries","directly","to","event","files","in","the","log_dir","to","be","consumed","by","TensorBoard",".","The","`","SummaryWriter","`","class","provides","a","high-level","API","to","create","an","event","file","in","a","given","directory","and","add","summaries","and","events","to","it",".","The","class","updates","the","file","contents","asynchronously",".","This","allows","a","training","program","to","call","methods","to","add","data","to","the","file","directly","from","the","training","loop",",","without","slowing","down","training","."]
docstr: Add a set of hyperparameters to be compared in TensorBoard.
  
  Args:
      hparam_dict (dict): Each key-value pair in the dictionary is the
        name of the hyper parameter and it's corresponding value.
        The type of the value can be one of `bool`, `string`, `float`,
        `int`, or `None`.
      metric_dict (dict): Each key-value pair in the dictionary is the
        name of the metric and it's corresponding value. Note that the key used
        here should be unique in the tensorboard record. Otherwise the value
        you added by ``add_scalar`` will be displayed in hparam plugin. In most
        cases, this is unwanted.
      hparam_domain_discrete: (Optional[Dict[str, List[Any]]]) A dictionary that
        contains names of the hyperparameters and all discrete values they can hold
      run_name (str): Name of the run, to be included as part of the logdir.
        If unspecified, will use current timestamp.
      global_step (int): Global step value to record
  
  Examples::
  
      from torch.utils.tensorboard import SummaryWriter
      with SummaryWriter() as w:
          for i in range(5):
              w.add_hparams({'lr': 0.1*i, 'bsize': i},
                            {'hparam/accuracy': 10*i, 'hparam/loss': 10*i})
  
  Expected result:
  
  .. image:: _static/img/tensorboard/add_hparam.png
     :scale: 50 %
docstr_tok: ["Add","a","set","of","hyperparameters","to","be","compared","in","TensorBoard",".","Args",":","hparam_dict","(","dict",")",":","Each","key-value","pair","in","the","dictionary","is","the","name","of","the","hyper","parameter","and","it","'s","corresponding","value",".","The","type","of","the","value","can","be","one","of","`","bool","`",",","`","string","`",",","`","float","`",",","`","int","`",",","or","`","None","`",".","metric_dict","(","dict",")",":","Each","key-value","pair","in","the","dictionary","is","the","name","of","the","metric","and","it","'s","corresponding","value",".","Note","that","the","key","used","here","should","be","unique","in","the","tensorboard","record",".","Otherwise","the","value","you","added","by","``","add_scalar","``","will","be","displayed","in","hparam","plugin",".","In","most","cases",",","this","is","unwanted",".","hparam_domain_discrete",":","(","Optional","[","Dict","[","str",",","List","[","Any","]","]","]",")","A","dictionary","that","contains","names","of","the","hyperparameters","and","all","discrete","values","they","can","hold","run_name","(","str",")",":","Name","of","the","run",",","to","be","included","as","part","of","the","logdir",".","If","unspecified",",","will","use","current","timestamp",".","global_step","(","int",")",":","Global","step","value","to","record","Examples",":",":","from","torch.utils.tensorboard","import","SummaryWriter","with","SummaryWriter","(",")","as","w",":","for","i","in","range","(","5",")",":","w.add_hparams","(","{","'lr","'",":","0.1","*","i",",","'bsize","'",":","i","}",",","{","'hparam\/accuracy","'",":","10","*","i",",","'hparam\/loss","'",":","10","*","i","}",")","Expected","result",":","..","image",":",":","_static\/img\/tensorboard\/add_hparam.png",":","scale",":","50","%"]
code: def add_hparams(
      self,
      hparam_dict,
      metric_dict,
      hparam_domain_discrete=None,
      run_name=None,
      global_step=None,
  ):
      """Add a set of hyperparameters to be compared in TensorBoard.
  
      Args:
          hparam_dict (dict): Each key-value pair in the dictionary is the
            name of the hyper parameter and it's corresponding value.
            The type of the value can be one of `bool`, `string`, `float`,
            `int`, or `None`.
          metric_dict (dict): Each key-value pair in the dictionary is the
            name of the metric and it's corresponding value. Note that the key used
            here should be unique in the tensorboard record. Otherwise the value
            you added by ``add_scalar`` will be displayed in hparam plugin. In most
            cases, this is unwanted.
          hparam_domain_discrete: (Optional[Dict[str, List[Any]]]) A dictionary that
            contains names of the hyperparameters and all discrete values they can hold
          run_name (str): Name of the run, to be included as part of the logdir.
            If unspecified, will use current timestamp.
          global_step (int): Global step value to record
  
      Examples::
  
          from torch.utils.tensorboard import SummaryWriter
          with SummaryWriter() as w:
              for i in range(5):
                  w.add_hparams({'lr': 0.1*i, 'bsize': i},
                                {'hparam/accuracy': 10*i, 'hparam/loss': 10*i})
  
      Expected result:
  
      .. image:: _static/img/tensorboard/add_hparam.png
         :scale: 50 %
  
      """
      torch._C._log_api_usage_once("tensorboard.logging.add_hparams")
      if type(hparam_dict) is not dict or type(metric_dict) is not dict:
          raise TypeError(
              "hparam_dict and metric_dict should be dictionary."
          )
      exp, ssi, sei = hparams(
          hparam_dict, metric_dict, hparam_domain_discrete
      )
  
      if not run_name:
          run_name = str(time.time())
      logdir = os.path.join(
          self._get_file_writer().get_logdir(), run_name
      )
      with SummaryWriter(log_dir=logdir) as w_hp:
          w_hp.file_writer.add_summary(exp, global_step)
          w_hp.file_writer.add_summary(ssi, global_step)
          w_hp.file_writer.add_summary(sei, global_step)
          for k, v in metric_dict.items():
              w_hp.add_scalar(k, v, global_step)
  
imports: import os
  import time
  from typing import List, Optional, Union, TYPE_CHECKING
  import torch
  from tensorboard.compat import tf
  from tensorboard.compat.proto import event_pb2
  from tensorboard.compat.proto.event_pb2 import Event, SessionLog
  from tensorboard.plugins.projector.projector_config_pb2 import ProjectorConfig
  from tensorboard.summary.writer.event_file_writer import EventFileWriter
  from ._convert_np import make_np
  from ._embedding import get_embedding_info, make_mat, make_sprite, make_tsv, write_pbtxt
  from ._onnx_graph import load_onnx_graph
  from ._pytorch_graph import graph
  from ._utils import figure_to_image
  from .summary import audio, custom_scalars, histogram, histogram_raw, hparams, image, image_boxes, mesh, pr_curve, pr_curve_raw, scalar, tensor_proto, text, video
label_desc: Use image node_id 5 for calling the SummaryWriter obj's underlying member method code with example usage: obj.add_hparams(hparam_dict, metric_dict, hparam_domain_discrete, run_name, global_step) without return types