code: def __init__(
      self,
      output_transform: Callable = lambda x: x,
      average: Optional[Union[bool, str]] = False,
      is_multilabel: bool = False,
      device: Union[str, torch.device] = torch.device("cpu"),
  ):
      if not (
          average is None
          or isinstance(average, bool)
          or average in ["macro", "micro", "weighted", "samples"]
      ):
          raise ValueError(
              "Argument average should be None or a boolean or one of values"
              " 'macro', 'micro', 'weighted' and 'samples'."
          )
  
      if average is True:
          self._average: Optional[Union[bool, str]] = "macro"
      else:
          self._average = average
      self.eps = 1e-20
      self._updated = False
      super(_BasePrecisionRecall, self).__init__(
          output_transform=output_transform,
          is_multilabel=is_multilabel,
          device=device,
      )
  
file_path: ignite/ignite/metrics/precision.py
imports: import warnings
  from typing import Callable, cast, Optional, Sequence, Union
  import torch
  import ignite.distributed
  from ignite.exceptions import NotComputableError
  from ignite.metrics.accuracy import _BaseClassification
  from ignite.metrics.metric import reinit__is_reduced, sync_all_reduce
  from ignite.utils import to_onehot
label_desc: Use image node_id 1 to create a new _BasePrecisionRecall object from inherited base classes: _BaseClassification with example: obj = _BasePrecisionRecall(output_transform, average, is_multilabel, device)