class_docstr: TensorBoardX Logger.
  
  Note that hparams will be written only after a trial has terminated.
  This logger automatically flattens nested dicts to show on TensorBoard:
  
      {"a": {"b": 1, "c": 2}} -> {"a/b": 1, "a/c": 2}
code: def log_trial_result(
      self, iteration: int, trial: "Trial", result: Dict
  ):
      if trial not in self._trial_writer:
          self.log_trial_start(trial)
  
      step = result.get(TIMESTEPS_TOTAL) or result[TRAINING_ITERATION]
  
      tmp = result.copy()
      for k in [
          "config",
          "pid",
          "timestamp",
          TIME_TOTAL_S,
          TRAINING_ITERATION,
      ]:
          if k in tmp:
              del tmp[k]  # not useful to log these
  
      flat_result = flatten_dict(tmp, delimiter="/")
      path = ["ray", "tune"]
      valid_result = {}
  
      for attr, value in flat_result.items():
          full_attr = "/".join(path + [attr])
          if isinstance(
              value, tuple(VALID_SUMMARY_TYPES)
          ) and not np.isnan(value):
              valid_result[full_attr] = value
              self._trial_writer[trial].add_scalar(
                  full_attr, value, global_step=step
              )
          elif (isinstance(value, list) and len(value) > 0) or (
              isinstance(value, np.ndarray) and value.size > 0
          ):
              valid_result[full_attr] = value
  
              # Must be video
              if isinstance(value, np.ndarray) and value.ndim == 5:
                  self._trial_writer[trial].add_video(
                      full_attr, value, global_step=step, fps=20
                  )
                  continue
  
              try:
                  self._trial_writer[trial].add_histogram(
                      full_attr, value, global_step=step
                  )
              # In case TensorboardX still doesn't think it's a valid value
              # (e.g. `[[]]`), warn and move on.
              except (ValueError, TypeError):
                  if log_once("invalid_tbx_value"):
                      logger.warning(
                          "You are trying to log an invalid value ({}={}) "
                          "via {}!".format(
                              full_attr, value, type(self).__name__
                          )
                      )
  
      self._trial_result[trial] = valid_result
      self._trial_writer[trial].flush()
  
imports: import logging
  import numpy
  from typing import TYPE_CHECKING, Dict
  from ray.air.constants import TRAINING_ITERATION
  from ray.tune.logger.logger import _LOGGER_DEPRECATION_WARNING, Logger, LoggerCallback
  from ray.util.debug import log_once
  from ray.tune.result import TIME_TOTAL_S, TIMESTEPS_TOTAL
  from ray.tune.utils import flatten_dict
  from ray.util.annotations import Deprecated, PublicAPI
label_desc: Use image node_id 3 for calling the TBXLoggerCallback obj's underlying member method code with example usage: obj.log_trial_result(iteration, trial, result) without return types