class_docstr: TensorBoardStatsHandler defines a set of Ignite Event-handlers for all the TensorBoard logics.
  It can be used for any Ignite Engine(trainer, validator and evaluator).
  And it can support both epoch level and iteration level with pre-defined TensorBoard event writer.
  The expected data source is Ignite ``engine.state.output`` and ``engine.state.metrics``.
  
  Default behaviors:
      - When EPOCH_COMPLETED, write each dictionary item in
        ``engine.state.metrics`` to TensorBoard.
      - When ITERATION_COMPLETED, write each dictionary item in
        ``self.output_transform(engine.state.output)`` to TensorBoard.
  
  Usage example is available in the tutorial:
  https://github.com/Project-MONAI/tutorials/blob/master/3d_segmentation/unet_segmentation_3d_ignite.ipynb.
class_docstr_tok: ["TensorBoardStatsHandler","defines","a","set","of","Ignite","Event-handlers","for","all","the","TensorBoard","logics",".","It","can","be","used","for","any","Ignite","Engine","(","trainer",",","validator","and","evaluator",")",".","And","it","can","support","both","epoch","level","and","iteration","level","with","pre-defined","TensorBoard","event","writer",".","The","expected","data","source","is","Ignite","``","engine.state.output","``","and","``","engine.state.metrics","``",".","Default","behaviors",":","-","When","EPOCH_COMPLETED",",","write","each","dictionary","item","in","``","engine.state.metrics","``","to","TensorBoard",".","-","When","ITERATION_COMPLETED",",","write","each","dictionary","item","in","``","self.output_transform","(","engine.state.output",")","``","to","TensorBoard",".","Usage","example","is","available","in","the","tutorial",":","https",":","\/\/github.com\/Project-MONAI\/tutorials\/blob\/master\/3d_segmentation\/unet_segmentation_3d_ignite.ipynb","."]
docstr: Write scale value into TensorBoard.
  Default to call `SummaryWriter.add_scalar()`.
  
  Args:
      _engine: Ignite Engine, unused argument.
      writer: TensorBoard or TensorBoardX writer, passed or created in TensorBoardHandler.
      tag: tag name in the TensorBoard.
      value: value of the scalar data for current step.
      step: index of current step.
docstr_tok: ["Write","scale","value","into","TensorBoard",".","Default","to","call","`","SummaryWriter.add_scalar","(",")","`",".","Args",":","_engine",":","Ignite","Engine",",","unused","argument",".","writer",":","TensorBoard","or","TensorBoardX","writer",",","passed","or","created","in","TensorBoardHandler",".","tag",":","tag","name","in","the","TensorBoard",".","value",":","value","of","the","scalar","data","for","current","step",".","step",":","index","of","current","step","."]
code: def _write_scalar(
      self,
      _engine: Engine,
      writer: SummaryWriter | SummaryWriterX,
      tag: str,
      value: Any,
      step: int,
  ) -> None:
      """
      Write scale value into TensorBoard.
      Default to call `SummaryWriter.add_scalar()`.
  
      Args:
          _engine: Ignite Engine, unused argument.
          writer: TensorBoard or TensorBoardX writer, passed or created in TensorBoardHandler.
          tag: tag name in the TensorBoard.
          value: value of the scalar data for current step.
          step: index of current step.
  
      """
      writer.add_scalar(tag, value, step)
  
imports: from __future__ import annotations
  import warnings
  from collections.abc import Callable, Sequence
  from typing import TYPE_CHECKING, Any
  import numpy
  import torch
  from monai.config import IgniteInfo
  from monai.utils import is_scalar, min_version, optional_import
  from monai.visualize import plot_2d_or_3d_image
label_desc: Use image node_id 5 for calling the TensorBoardStatsHandler obj's underlying member method code with example usage: obj._write_scalar(_engine, writer, tag, value, step) without return types