code: def _check_shape(self, output: Sequence[torch.Tensor]) -> None:
      y_pred, y = output
  
      if not (
          y.ndimension() == y_pred.ndimension()
          or y.ndimension() + 1 == y_pred.ndimension()
      ):
          raise ValueError(
              "y must have shape of (batch_size, ...) and y_pred must have "
              "shape of (batch_size, num_categories, ...) or (batch_size, ...), "
              f"but given {y.shape} vs {y_pred.shape}."
          )
  
      y_shape = y.shape
      y_pred_shape: Tuple[int, ...] = y_pred.shape
  
      if y.ndimension() + 1 == y_pred.ndimension():
          y_pred_shape = (y_pred_shape[0],) + y_pred_shape[2:]
  
      if not (y_shape == y_pred_shape):
          raise ValueError("y and y_pred must have compatible shapes.")
  
      if self._is_multilabel and not (
          y.shape == y_pred.shape
          and y.ndimension() > 1
          and y.shape[1] > 1
      ):
          raise ValueError(
              "y and y_pred must have same shape of (batch_size, num_categories, ...) and num_categories > 1."
          )
  
file_path: ignite/ignite/metrics/accuracy.py
imports: from typing import Callable, Optional, Sequence, Tuple, Union
  import torch
  from ignite.exceptions import NotComputableError
  from ignite.metrics.metric import Metric, reinit__is_reduced, sync_all_reduce
label_desc: Use image node_id 3 for calling the _BaseClassification obj's underlying member method code with example usage: obj._check_shape(output) without return types