class_docstr: Event handler triggered on completing every iteration to save the classification predictions as CSV file.
  If running in distributed data parallel, only saves CSV file in the specified rank.
class_docstr_tok: ["Event","handler","triggered","on","completing","every","iteration","to","save","the","classification","predictions","as","CSV","file",".","If","running","in","distributed","data","parallel",",","only","saves","CSV","file","in","the","specified","rank","."]
docstr: Args:
      output_dir: if `saver=None`, output CSV file directory.
      filename: if `saver=None`, name of the saved CSV file name.
      delimiter: the delimiter character in the saved file, default to "," as the default output type is `csv`.
          to be consistent with: https://docs.python.org/3/library/csv.html#csv.Dialect.delimiter.
      overwrite: if `saver=None`, whether to overwriting existing file content, if True,
          will clear the file before saving. otherwise, will append new content to the file.
      batch_transform: a callable that is used to extract the `meta_data` dictionary of
          the input images from `ignite.engine.state.batch`. the purpose is to get the input
          filenames from the `meta_data` and store with classification results together.
          `engine.state` and `batch_transform` inherit from the ignite concept:
          https://pytorch.org/ignite/concepts.html#state, explanation and usage example are in the tutorial:
          https://github.com/Project-MONAI/tutorials/blob/master/modules/batch_output_transform.ipynb.
      output_transform: a callable that is used to extract the model prediction data from
          `ignite.engine.state.output`. the first dimension of its output will be treated as
          the batch dimension. each item in the batch will be saved individually.
          `engine.state` and `output_transform` inherit from the ignite concept:
          https://pytorch.org/ignite/concepts.html#state, explanation and usage example are in the tutorial:
          https://github.com/Project-MONAI/tutorials/blob/master/modules/batch_output_transform.ipynb.
      name: identifier of logging.logger to use, defaulting to `engine.logger`.
      save_rank: only the handler on specified rank will save to CSV file in multi-gpus validation,
          default to 0.
      saver: the saver instance to save classification results, if None, create a CSVSaver internally.
          the saver must provide `save_batch(batch_data, meta_data)` and `finalize()` APIs.
docstr_tok: ["Args",":","output_dir",":","if","`","saver=None","`",",","output","CSV","file","directory",".","filename",":","if","`","saver=None","`",",","name","of","the","saved","CSV","file","name",".","delimiter",":","the","delimiter","character","in","the","saved","file",",","default","to","``",",","''","as","the","default","output","type","is","`","csv","`",".","to","be","consistent","with",":","https",":","\/\/docs.python.org\/3\/library\/csv.html","#","csv.Dialect.delimiter",".","overwrite",":","if","`","saver=None","`",",","whether","to","overwriting","existing","file","content",",","if","True",",","will","clear","the","file","before","saving",".","otherwise",",","will","append","new","content","to","the","file",".","batch_transform",":","a","callable","that","is","used","to","extract","the","`","meta_data","`","dictionary","of","the","input","images","from","`","ignite.engine.state.batch","`",".","the","purpose","is","to","get","the","input","filenames","from","the","`","meta_data","`","and","store","with","classification","results","together",".","`","engine.state","`","and","`","batch_transform","`","inherit","from","the","ignite","concept",":","https",":","\/\/pytorch.org\/ignite\/concepts.html","#","state",",","explanation","and","usage","example","are","in","the","tutorial",":","https",":","\/\/github.com\/Project-MONAI\/tutorials\/blob\/master\/modules\/batch_output_transform.ipynb",".","output_transform",":","a","callable","that","is","used","to","extract","the","model","prediction","data","from","`","ignite.engine.state.output","`",".","the","first","dimension","of","its","output","will","be","treated","as","the","batch","dimension",".","each","item","in","the","batch","will","be","saved","individually",".","`","engine.state","`","and","`","output_transform","`","inherit","from","the","ignite","concept",":","https",":","\/\/pytorch.org\/ignite\/concepts.html","#","state",",","explanation","and","usage","example","are","in","the","tutorial",":","https",":","\/\/github.com\/Project-MONAI\/tutorials\/blob\/master\/modules\/batch_output_transform.ipynb",".","name",":","identifier","of","logging.logger","to","use",",","defaulting","to","`","engine.logger","`",".","save_rank",":","only","the","handler","on","specified","rank","will","save","to","CSV","file","in","multi-gpus","validation",",","default","to","0.","saver",":","the","saver","instance","to","save","classification","results",",","if","None",",","create","a","CSVSaver","internally",".","the","saver","must","provide","`","save_batch","(","batch_data",",","meta_data",")","`","and","`","finalize","(",")","`","APIs","."]
code: def __init__(
      self,
      output_dir: str = "./",
      filename: str = "predictions.csv",
      delimiter: str = ",",
      overwrite: bool = True,
      batch_transform: Callable = lambda x: x,
      output_transform: Callable = lambda x: x,
      name: str | None = None,
      save_rank: int = 0,
      saver: CSVSaver | None = None,
  ) -> None:
      """
      Args:
          output_dir: if `saver=None`, output CSV file directory.
          filename: if `saver=None`, name of the saved CSV file name.
          delimiter: the delimiter character in the saved file, default to "," as the default output type is `csv`.
              to be consistent with: https://docs.python.org/3/library/csv.html#csv.Dialect.delimiter.
          overwrite: if `saver=None`, whether to overwriting existing file content, if True,
              will clear the file before saving. otherwise, will append new content to the file.
          batch_transform: a callable that is used to extract the `meta_data` dictionary of
              the input images from `ignite.engine.state.batch`. the purpose is to get the input
              filenames from the `meta_data` and store with classification results together.
              `engine.state` and `batch_transform` inherit from the ignite concept:
              https://pytorch.org/ignite/concepts.html#state, explanation and usage example are in the tutorial:
              https://github.com/Project-MONAI/tutorials/blob/master/modules/batch_output_transform.ipynb.
          output_transform: a callable that is used to extract the model prediction data from
              `ignite.engine.state.output`. the first dimension of its output will be treated as
              the batch dimension. each item in the batch will be saved individually.
              `engine.state` and `output_transform` inherit from the ignite concept:
              https://pytorch.org/ignite/concepts.html#state, explanation and usage example are in the tutorial:
              https://github.com/Project-MONAI/tutorials/blob/master/modules/batch_output_transform.ipynb.
          name: identifier of logging.logger to use, defaulting to `engine.logger`.
          save_rank: only the handler on specified rank will save to CSV file in multi-gpus validation,
              default to 0.
          saver: the saver instance to save classification results, if None, create a CSVSaver internally.
              the saver must provide `save_batch(batch_data, meta_data)` and `finalize()` APIs.
  
      """
      self.save_rank = save_rank
      self.output_dir = output_dir
      self.filename = filename
      self.delimiter = delimiter
      self.overwrite = overwrite
      self.batch_transform = batch_transform
      self.output_transform = output_transform
      self.saver = saver
  
      self.logger = logging.getLogger(name)
      self._name = name
      self._outputs: list[torch.Tensor] = []
      self._filenames: list[str] = []
  
file_path: MONAI/monai/handlers/classification_saver.py
imports: from __future__ import annotations
  import logging
  import warnings
  from collections.abc import Callable
  from typing import TYPE_CHECKING
  import torch
  from monai.config import IgniteInfo
  from monai.data import CSVSaver, decollate_batch
  from monai.utils import ImageMetaKey
  from monai.utils import evenly_divisible_all_gather, min_version, optional_import, string_list_all_gather
label_desc: Use image node_id 1 to create a new ClassificationSaver object  with example: obj = ClassificationSaver(output_dir, filename, delimiter, overwrite, batch_transform, output_transform, name, save_rank, saver)