class_docstr: Ignite handler to execute the `decollate batch` logic for `engine.state.batch` and `engine.state.output`.
  Typical usage is to set `decollate=False` in the engine and execute some postprocessing logic first
  then decollate the batch, otherwise, engine will decollate batch before the postprocessing.
  
  Args:
      event: expected EVENT to attach the handler, should be "MODEL_COMPLETED" or "ITERATION_COMPLETED".
          default to "MODEL_COMPLETED".
      detach: whether to detach the tensors. scalars tensors will be detached into number types
          instead of torch tensors.
      decollate_batch: whether to decollate `engine.state.batch` of ignite engine.
      batch_keys: if `decollate_batch=True`, specify the keys of the corresponding items to decollate
          in `engine.state.batch`, note that it will delete other keys not specified. if None,
          will decollate all the keys. it replicates the scalar values to every item of the decollated list.
      decollate_output: whether to decollate `engine.state.output` of ignite engine.
      output_keys: if `decollate_output=True`, specify the keys of the corresponding items to decollate
          in `engine.state.output`, note that it will delete other keys not specified. if None,
          will decollate all the keys. it replicates the scalar values to every item of the decollated list.
      allow_missing_keys: don't raise exception if key is missing.
code: def __init__(
      self,
      event: str = "MODEL_COMPLETED",
      detach: bool = True,
      decollate_batch: bool = True,
      batch_keys: KeysCollection | None = None,
      decollate_output: bool = True,
      output_keys: KeysCollection | None = None,
      allow_missing_keys: bool = False,
  ):
      event = event.upper()
      if event not in ("MODEL_COMPLETED", "ITERATION_COMPLETED"):
          raise ValueError(
              "event should be `MODEL_COMPLETED` or `ITERATION_COMPLETED`."
          )
      self.event = event
  
      self.batch_transform = (
          Decollated(
              keys=batch_keys,
              detach=detach,
              allow_missing_keys=allow_missing_keys,
          )
          if decollate_batch
          else None
      )
  
      self.output_transform = (
          Decollated(
              keys=output_keys,
              detach=detach,
              allow_missing_keys=allow_missing_keys,
          )
          if decollate_output
          else None
      )
  
file_path: MONAI/monai/handlers/decollate_batch.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  from monai.config import IgniteInfo, KeysCollection
  from monai.engines.utils import IterationEvents
  from monai.transforms import Decollated
  from monai.utils import min_version, optional_import
label_desc: Use image node_id 1 to create a new DecollateBatch object  with example: obj = DecollateBatch(event, detach, decollate_batch, batch_keys, decollate_output, output_keys, allow_missing_keys)