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: Execute epoch level event write operation.
  Default to write the values from Ignite `engine.state.metrics` dict and
  write the values of specified attributes of `engine.state`.
  
  Args:
      engine: Ignite Engine, it can be a trainer, validator or evaluator.
      writer: TensorBoard or TensorBoardX writer, passed or created in TensorBoardHandler.
docstr_tok: ["Execute","epoch","level","event","write","operation",".","Default","to","write","the","values","from","Ignite","`","engine.state.metrics","`","dict","and","write","the","values","of","specified","attributes","of","`","engine.state","`",".","Args",":","engine",":","Ignite","Engine",",","it","can","be","a","trainer",",","validator","or","evaluator",".","writer",":","TensorBoard","or","TensorBoardX","writer",",","passed","or","created","in","TensorBoardHandler","."]
code: def _default_epoch_writer(
      self, engine: Engine, writer: SummaryWriter | SummaryWriterX
  ) -> None:
      """
      Execute epoch level event write operation.
      Default to write the values from Ignite `engine.state.metrics` dict and
      write the values of specified attributes of `engine.state`.
  
      Args:
          engine: Ignite Engine, it can be a trainer, validator or evaluator.
          writer: TensorBoard or TensorBoardX writer, passed or created in TensorBoardHandler.
  
      """
      current_epoch = self.global_epoch_transform(engine.state.epoch)
      summary_dict = engine.state.metrics
      for name, value in summary_dict.items():
          if is_scalar(value):
              self._write_scalar(
                  engine, writer, name, value, current_epoch
              )
  
      if self.state_attributes is not None:
          for attr in self.state_attributes:
              self._write_scalar(
                  engine,
                  writer,
                  attr,
                  getattr(engine.state, attr, None),
                  current_epoch,
              )
      writer.flush()
  
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 6 for calling the TensorBoardStatsHandler obj's underlying member method code with example usage: obj._default_epoch_writer(engine, writer) without return types