class_docstr: Base class for aggregation metrics.
  
  Args:
      fn: string specifying the reduction function
      default_value: default tensor value to use for the metric state
      nan_strategy: options:
          - ``'error'``: if any `nan` values are encountered will give a RuntimeError
          - ``'warn'``: if any `nan` values are encountered will give a warning and continue
          - ``'ignore'``: all `nan` values are silently removed
          - a float: if a float is provided will impute any `nan` values with this value
  
      state_name: name of the metric state
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
  
  Raises:
      ValueError:
          If ``nan_strategy`` is not one of ``error``, ``warn``, ``ignore`` or a float
class_docstr_tok: ["Base","class","for","aggregation","metrics",".","Args",":","fn",":","string","specifying","the","reduction","function","default_value",":","default","tensor","value","to","use","for","the","metric","state","nan_strategy",":","options",":","-","``","'error","'","``",":","if","any","`","nan","`","values","are","encountered","will","give","a","RuntimeError","-","``","'warn","'","``",":","if","any","`","nan","`","values","are","encountered","will","give","a","warning","and","continue","-","``","'ignore","'","``",":","all","`","nan","`","values","are","silently","removed","-","a","float",":","if","a","float","is","provided","will","impute","any","`","nan","`","values","with","this","value","state_name",":","name","of","the","metric","state","kwargs",":","Additional","keyword","arguments",",","see",":","ref",":","`","Metric","kwargs","`","for","more","info",".","Raises",":","ValueError",":","If","``","nan_strategy","``","is","not","one","of","``","error","``",",","``","warn","``",",","``","ignore","``","or","a","float"]
code: def __init__(
      self,
      fn: Union[Callable, str],
      default_value: Union[Tensor, List],
      nan_strategy: Union[str, float] = "error",
      state_name: str = "value",
      **kwargs: Any,
  ) -> None:
      super().__init__(**kwargs)
      allowed_nan_strategy = ("error", "warn", "ignore")
      if nan_strategy not in allowed_nan_strategy and not isinstance(
          nan_strategy, float
      ):
          raise ValueError(
              f"Arg `nan_strategy` should either be a float or one of {allowed_nan_strategy}"
              f" but got {nan_strategy}."
          )
  
      self.nan_strategy = nan_strategy
      self.add_state(
          state_name, default=default_value, dist_reduce_fx=fn
      )
      self.state_name = state_name
  
imports: from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
  import torch
  from torch import Tensor
  from torchmetrics.metric import Metric
  from torchmetrics.utilities import rank_zero_warn
  from torchmetrics.utilities.data import dim_zero_cat
  from torchmetrics.utilities.imports import _MATPLOTLIB_AVAILABLE
  from torchmetrics.utilities.plot import _AX_TYPE, _PLOT_OUT_TYPE
  from torchmetrics.wrappers.running import Running
label_desc: Use image node_id 1 to create a new BaseAggregator object from inherited base classes: Metric with example: obj = BaseAggregator(fn, default_value, nan_strategy, state_name)