code: def _check_same_shape(preds: Tensor, target: Tensor) -> None:
      """Check that predictions and target have the same shape, else raise error."""
      if preds.shape != target.shape:
          raise RuntimeError(
              f"Predictions and targets are expected to have the same shape, but got {preds.shape} and {target.shape}."
          )
  
imports: import logging
  import multiprocessing
  import os
  from functools import partial
  from time import perf_counter
  from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Tuple, no_type_check
  from unittest.mock import Mock
  import torch
  from torch import Tensor
  from torchmetrics.metric import Metric
  from torchmetrics.utilities.data import select_topk, to_onehot
  from torchmetrics.utilities.enums import DataType
label_desc: Use image node_id 2 for calling a global function with example usage: _check_same_shape(preds, target) without return types