code: def hparams(hparam_dict=None, metric_dict=None):
      from tensorboardX.proto.plugin_hparams_pb2 import (
          HParamsPluginData,
          SessionEndInfo,
          SessionStartInfo,
      )
      from tensorboardX.proto.api_pb2 import (
          Experiment,
          HParamInfo,
          MetricInfo,
          MetricName,
          Status,
          DataType,
      )
  
      PLUGIN_NAME = "hparams"
      PLUGIN_DATA_VERSION = 0
  
      EXPERIMENT_TAG = "_hparams_/experiment"
      SESSION_START_INFO_TAG = "_hparams_/session_start_info"
      SESSION_END_INFO_TAG = "_hparams_/session_end_info"
  
      # TODO: expose other parameters in the future.
      # hp = HParamInfo(name='lr',display_name='learning rate', type=DataType.DATA_TYPE_FLOAT64, domain_interval=Interval(min_value=10, max_value=100))  # noqa E501
      # mt = MetricInfo(name=MetricName(tag='accuracy'), display_name='accuracy', description='', dataset_type=DatasetType.DATASET_VALIDATION)  # noqa E501
      # exp = Experiment(name='123', description='456', time_created_secs=100.0, hparam_infos=[hp], metric_infos=[mt], user='tw')  # noqa E501
  
      hps = []
  
      ssi = SessionStartInfo()
      for k, v in hparam_dict.items():
          if v is None:
              continue
  
          if isinstance(v, str):
              ssi.hparams[k].string_value = v
              hps.append(
                  HParamInfo(
                      name=k, type=DataType.Value("DATA_TYPE_STRING")
                  )
              )
              continue
  
          if isinstance(v, bool):
              ssi.hparams[k].bool_value = v
              hps.append(
                  HParamInfo(
                      name=k, type=DataType.Value("DATA_TYPE_BOOL")
                  )
              )
              continue
  
          if isinstance(v, int) or isinstance(v, float):
              v = make_np(v)[0]
              ssi.hparams[k].number_value = v
              hps.append(
                  HParamInfo(
                      name=k, type=DataType.Value("DATA_TYPE_FLOAT64")
                  )
              )
              continue
  
          if callable(v):
              ssi.hparams[k].string_value = getattr(
                  v, "__name__", str(v)
              )
              hps.append(
                  HParamInfo(
                      name=k, type=DataType.Value("DATA_TYPE_STRING")
                  )
              )
              continue
  
          hps.append(
              HParamInfo(name=k, type=DataType.Value("DATA_TYPE_UNSET"))
          )
  
      content = HParamsPluginData(
          session_start_info=ssi, version=PLUGIN_DATA_VERSION
      )
      smd = SummaryMetadata(
          plugin_data=SummaryMetadata.PluginData(
              plugin_name=PLUGIN_NAME,
              content=content.SerializeToString(),
          )
      )
      ssi = Summary(
          value=[
              Summary.Value(tag=SESSION_START_INFO_TAG, metadata=smd)
          ]
      )
  
      mts = [
          MetricInfo(name=MetricName(tag=k)) for k in metric_dict.keys()
      ]
  
      exp = Experiment(hparam_infos=hps, metric_infos=mts)
      content = HParamsPluginData(
          experiment=exp, version=PLUGIN_DATA_VERSION
      )
      smd = SummaryMetadata(
          plugin_data=SummaryMetadata.PluginData(
              plugin_name=PLUGIN_NAME,
              content=content.SerializeToString(),
          )
      )
      exp = Summary(
          value=[Summary.Value(tag=EXPERIMENT_TAG, metadata=smd)]
      )
  
      sei = SessionEndInfo(status=Status.Value("STATUS_SUCCESS"))
      content = HParamsPluginData(
          session_end_info=sei, version=PLUGIN_DATA_VERSION
      )
      smd = SummaryMetadata(
          plugin_data=SummaryMetadata.PluginData(
              plugin_name=PLUGIN_NAME,
              content=content.SerializeToString(),
          )
      )
      sei = Summary(
          value=[Summary.Value(tag=SESSION_END_INFO_TAG, metadata=smd)]
      )
      return exp, ssi, sei
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import numpy
  import os
  import re
  from .proto.summary_pb2 import Summary
  from .proto.summary_pb2 import HistogramProto
  from .proto.summary_pb2 import SummaryMetadata
  from .proto.tensor_pb2 import TensorProto
  from .proto.tensor_shape_pb2 import TensorShapeProto
  from .proto.plugin_pr_curve_pb2 import PrCurvePluginData
  from .proto.plugin_text_pb2 import TextPluginData
  from .proto.plugin_mesh_pb2 import MeshPluginData
  from .proto import layout_pb2
  from .x2num import make_np
  from .utils import _prepare_video, convert_to_HWC, convert_to_NTCHW
label_desc: Use image node_id 3 for calling a global function with example usage: hparams(hparam_dict, metric_dict) and returns: exp,  ssi,  sei