docstr: Initialize the states for the different statistics.
docstr_tok: ["Initialize","the","states","for","the","different","statistics","."]
code: def _create_state(
      self,
      size: int,
      multidim_average: Literal["global", "samplewise"] = "global",
  ) -> None:
      """Initialize the states for the different statistics."""
      default: Union[Callable[[], list], Callable[[], Tensor]]
      if multidim_average == "samplewise":
          default = list
          dist_reduce_fx = "cat"
      else:
          default = lambda: torch.zeros(size, dtype=torch.long)
          dist_reduce_fx = "sum"
  
      self.add_state("tp", default(), dist_reduce_fx=dist_reduce_fx)
      self.add_state("fp", default(), dist_reduce_fx=dist_reduce_fx)
      self.add_state("tn", default(), dist_reduce_fx=dist_reduce_fx)
      self.add_state("fn", default(), dist_reduce_fx=dist_reduce_fx)
  
imports: from typing import Any, Callable, List, Optional, Tuple, Type, Union
  import torch
  from torch import Tensor
  from typing_extensions import Literal
  from torchmetrics.classification.base import _ClassificationTaskWrapper
  from torchmetrics.functional.classification.stat_scores import _binary_stat_scores_arg_validation, _binary_stat_scores_compute, _binary_stat_scores_format, _binary_stat_scores_tensor_validation, _binary_stat_scores_update, _multiclass_stat_scores_arg_validation, _multiclass_stat_scores_compute, _multiclass_stat_scores_format, _multiclass_stat_scores_tensor_validation, _multiclass_stat_scores_update, _multilabel_stat_scores_arg_validation, _multilabel_stat_scores_compute, _multilabel_stat_scores_format, _multilabel_stat_scores_tensor_validation, _multilabel_stat_scores_update
  from torchmetrics.metric import Metric
  from torchmetrics.utilities.data import dim_zero_cat
  from torchmetrics.utilities.enums import ClassificationTask
label_desc: Use image node_id 1 for calling the _AbstractStatScores obj's underlying member method code with example usage: obj._create_state(size, multidim_average) without return types