class_docstr: Base class of cumulative metric which collects metrics on each mini-batch data at the iteration level.
  
  Typically, it computes some intermediate results for each iteration, adds them to the buffers,
  then the buffer contents could be gathered and aggregated for the final result when epoch completed.
  Currently,``Cumulative.aggregate()`` and ``IterationMetric._compute_tensor()`` are expected to be implemented.
  
  For example, `MeanDice` inherits this class and the usage is as follows:
  
  .. code-block:: python
  
      dice_metric = DiceMetric(include_background=True, reduction="mean")
  
      for val_data in val_loader:
          val_outputs = model(val_data["img"])
          val_outputs = [postprocessing_transform(i) for i in decollate_batch(val_outputs)]
          # compute metric for current iteration
          dice_metric(y_pred=val_outputs, y=val_data["seg"])  # callable to add metric to the buffer
  
      # aggregate the final mean dice result
      metric = dice_metric.aggregate().item()
  
      # reset the status for next computation round
      dice_metric.reset()
  
  And to load `predictions` and `labels` from files, then compute metrics with multi-processing, please refer to:
  https://github.com/Project-MONAI/tutorials/blob/master/modules/compute_metric.py.
class_docstr_tok: ["Base","class","of","cumulative","metric","which","collects","metrics","on","each","mini-batch","data","at","the","iteration","level",".","Typically",",","it","computes","some","intermediate","results","for","each","iteration",",","adds","them","to","the","buffers",",","then","the","buffer","contents","could","be","gathered","and","aggregated","for","the","final","result","when","epoch","completed",".","Currently",",","``","Cumulative.aggregate","(",")","``","and","``","IterationMetric._compute_tensor","(",")","``","are","expected","to","be","implemented",".","For","example",",","`","MeanDice","`","inherits","this","class","and","the","usage","is","as","follows",":","..","code-block",":",":","python","dice_metric","=","DiceMetric","(","include_background=True",",","reduction=","''","mean","''",")","for","val_data","in","val_loader",":","val_outputs","=","model","(","val_data","[","``","img","''","]",")","val_outputs","=","[","postprocessing_transform","(","i",")","for","i","in","decollate_batch","(","val_outputs",")","]","#","compute","metric","for","current","iteration","dice_metric","(","y_pred=val_outputs",",","y=val_data","[","``","seg","''","]",")","#","callable","to","add","metric","to","the","buffer","#","aggregate","the","final","mean","dice","result","metric","=","dice_metric.aggregate","(",")",".item","(",")","#","reset","the","status","for","next","computation","round","dice_metric.reset","(",")","And","to","load","`","predictions","`","and","`","labels","`","from","files",",","then","compute","metrics","with","multi-processing",",","please","refer","to",":","https",":","\/\/github.com\/Project-MONAI\/tutorials\/blob\/master\/modules\/compute_metric.py","."]
docstr: Execute basic computation for model prediction and ground truth.
  It can support  both `list of channel-first Tensor` and `batch-first Tensor`.
  Users call this API to execute computation on every batch of data, then accumulate the results,
  or accumulate the original `y_pred` and `y`, then execute on the accumulated data.
  
  Args:
      y_pred: the model prediction data to compute, must be a list of `channel-first` Tensor
          or a `batch-first` Tensor.
      y: the ground truth to compute, must be a list of `channel-first` Tensor
          or a `batch-first` Tensor.
      kwargs: additional parameters for specific metric computation logic (e.g. ``spacing`` for SurfaceDistanceMetric, etc.).
  
  Returns:
      The computed metric values at the iteration level. The output shape should be
      a `batch-first` tensor (BC[HWD]) or a list of `batch-first` tensors.
docstr_tok: ["Execute","basic","computation","for","model","prediction","and","ground","truth",".","It","can","support","both","`","list","of","channel-first","Tensor","`","and","`","batch-first","Tensor","`",".","Users","call","this","API","to","execute","computation","on","every","batch","of","data",",","then","accumulate","the","results",",","or","accumulate","the","original","`","y_pred","`","and","`","y","`",",","then","execute","on","the","accumulated","data",".","Args",":","y_pred",":","the","model","prediction","data","to","compute",",","must","be","a","list","of","`","channel-first","`","Tensor","or","a","`","batch-first","`","Tensor",".","y",":","the","ground","truth","to","compute",",","must","be","a","list","of","`","channel-first","`","Tensor","or","a","`","batch-first","`","Tensor",".","kwargs",":","additional","parameters","for","specific","metric","computation","logic","(","e.g",".","``","spacing","``","for","SurfaceDistanceMetric",",","etc.",")",".","Returns",":","The","computed","metric","values","at","the","iteration","level",".","The","output","shape","should","be","a","`","batch-first","`","tensor","(","BC","[","HWD","]",")","or","a","list","of","`","batch-first","`","tensors","."]
code: def __call__(
      self,
      y_pred: TensorOrList,
      y: TensorOrList | None = None,
      **kwargs: Any,
  ) -> torch.Tensor | Sequence[torch.Tensor | Sequence[torch.Tensor]]:
      """
      Execute basic computation for model prediction and ground truth.
      It can support  both `list of channel-first Tensor` and `batch-first Tensor`.
      Users call this API to execute computation on every batch of data, then accumulate the results,
      or accumulate the original `y_pred` and `y`, then execute on the accumulated data.
  
      Args:
          y_pred: the model prediction data to compute, must be a list of `channel-first` Tensor
              or a `batch-first` Tensor.
          y: the ground truth to compute, must be a list of `channel-first` Tensor
              or a `batch-first` Tensor.
          kwargs: additional parameters for specific metric computation logic (e.g. ``spacing`` for SurfaceDistanceMetric, etc.).
  
      Returns:
          The computed metric values at the iteration level. The output shape should be
          a `batch-first` tensor (BC[HWD]) or a list of `batch-first` tensors.
      """
      ret = super().__call__(y_pred=y_pred, y=y, **kwargs)
      if isinstance(ret, (tuple, list)):
          self.extend(*ret)
      else:
          self.extend(ret)
  
      return ret
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  from collections.abc import Sequence
  from typing import Any
  import torch
  from monai.config import TensorOrList
  from monai.utils import convert_data_type, evenly_divisible_all_gather
label_desc: Use image node_id 1 for calling the CumulativeIterationMetric obj's underlying member method code with example usage: obj.__call__(y_pred, y) and returns: ret