docstr: Logs the metric dict passed in. If `step` parameter is None and `step` key is presented is metrics, uses
  metrics["step"] as a step.
  
  Args:
      metrics: Metric values
      step: Step for which metrics should be logged. Default value is `self.global_step` during training or
          the total validation / test log step count during validation and testing.
docstr_tok: ["Logs","the","metric","dict","passed","in",".","If","`","step","`","parameter","is","None","and","`","step","`","key","is","presented","is","metrics",",","uses","metrics","[","``","step","''","]","as","a","step",".","Args",":","metrics",":","Metric","values","step",":","Step","for","which","metrics","should","be","logged",".","Default","value","is","`","self.global_step","`","during","training","or","the","total","validation","\/","test","log","step","count","during","validation","and","testing","."]
code: def log_metrics(
      self, metrics: _OUT_DICT, step: Optional[int] = None
  ) -> None:
      """Logs the metric dict passed in. If `step` parameter is None and `step` key is presented is metrics, uses
      metrics["step"] as a step.
  
      Args:
          metrics: Metric values
          step: Step for which metrics should be logged. Default value is `self.global_step` during training or
              the total validation / test log step count during validation and testing.
  
      """
      if not self.trainer.loggers or not metrics:
          return
  
      self._logged_metrics.update(metrics)
  
      # turn all tensors to scalars
      scalar_metrics = convert_tensors_to_scalars(metrics)
  
      if step is None:
          step = scalar_metrics.pop("step", None)
  
      if step is None:
          # added metrics for convenience
          scalar_metrics.setdefault("epoch", self.trainer.current_epoch)
          step = self.trainer.fit_loop.epoch_loop._batches_that_stepped
  
      # log actual metrics
      for logger in self.trainer.loggers:
          logger.log_metrics(metrics=scalar_metrics, step=step)
          logger.save()
  
imports: from typing import Any, Iterable, Optional, Union
  from lightning_utilities.core.apply_func import apply_to_collection
  from torch import Tensor
  import lightning.pytorch
  from lightning.fabric.loggers.tensorboard import _TENSORBOARD_AVAILABLE, _TENSORBOARDX_AVAILABLE
  from lightning.fabric.plugins.environments import SLURMEnvironment
  from lightning.fabric.utilities import move_data_to_device
  from lightning.fabric.utilities.apply_func import convert_tensors_to_scalars
  from lightning.pytorch.loggers import CSVLogger, Logger, TensorBoardLogger
  from lightning.pytorch.trainer.connectors.logger_connector.result import _METRICS, _OUT_DICT, _PBAR_DICT
  from lightning.pytorch.utilities.rank_zero import WarningCache
label_desc: Use image node_id 5 for calling the _LoggerConnector obj's underlying member method code with example usage: obj.log_metrics(metrics, step) without return types