code: def _multiclass_precision_recall_curve_tensor_validation(
      preds: Tensor,
      target: Tensor,
      num_classes: int,
      ignore_index: Optional[int] = None,
  ) -> None:
      """Validate tensor input.
  
      - target should have one more dimension than preds and all dimensions except for preds.shape[1] should match
      exactly. preds.shape[1] should have size equal to number of classes
      - all values in target tensor that are not ignored have to be in {0, 1}
  
      """
      if not preds.ndim == target.ndim + 1:
          raise ValueError(
              f"Expected `preds` to have one more dimension than `target` but got {preds.ndim} and {target.ndim}"
          )
      if target.is_floating_point():
          raise ValueError(
              f"Expected argument `target` to be an int or long tensor, but got tensor with dtype {target.dtype}"
          )
      if not preds.is_floating_point():
          raise ValueError(
              f"Expected `preds` to be a float tensor, but got {preds.dtype}"
          )
      if preds.shape[1] != num_classes:
          raise ValueError(
              "Expected `preds.shape[1]` to be equal to the number of classes but"
              f" got {preds.shape[1]} and {num_classes}."
          )
      if (
          preds.shape[0] != target.shape[0]
          or preds.shape[2:] != target.shape[1:]
      ):
          raise ValueError(
              "Expected the shape of `preds` should be (N, C, ...) and the shape of `target` should be (N, ...)"
              f" but got {preds.shape} and {target.shape}"
          )
  
      num_unique_values = len(torch.unique(target))
      check = (
          num_unique_values > num_classes
          if ignore_index is None
          else num_unique_values > num_classes + 1
      )
      if check:
          raise RuntimeError(
              "Detected more unique values in `target` than `num_classes`. Expected only "
              f"{num_classes if ignore_index is None else num_classes + 1} but found "
              f"{num_unique_values} in `target`."
          )
  
imports: from typing import List, Optional, Sequence, Tuple, Union
  import torch
  from torch import Tensor, tensor
  from torch.nn import functional
  from typing_extensions import Literal
  from torchmetrics.utilities.checks import _check_same_shape
  from torchmetrics.utilities.compute import _safe_divide, interp
  from torchmetrics.utilities.data import _bincount, _cumsum
  from torchmetrics.utilities.enums import ClassificationTask
label_desc: Use image node_id 12 for calling a global function with example usage: _multiclass_precision_recall_curve_tensor_validation(preds, target, num_classes, ignore_index) without return types