class_docstr: Checks if segmentation label images (in keys) have the same spatial shape as the main image (in source_key),
  and raise an error if the shapes are significantly different.
  If the shapes are only slightly different (within an allowed_shape_difference in each dim), then resize the label using
  nearest interpolation. This transform is designed to correct datasets with slight label shape mismatches.
  Generally image and segmentation label must have the same spatial shape, however some public datasets are having slight
  shape mismatches, which will cause potential crashes when calculating loss or metric functions.
class_docstr_tok: ["Checks","if","segmentation","label","images","(","in","keys",")","have","the","same","spatial","shape","as","the","main","image","(","in","source_key",")",",","and","raise","an","error","if","the","shapes","are","significantly","different",".","If","the","shapes","are","only","slightly","different","(","within","an","allowed_shape_difference","in","each","dim",")",",","then","resize","the","label","using","nearest","interpolation",".","This","transform","is","designed","to","correct","datasets","with","slight","label","shape","mismatches",".","Generally","image","and","segmentation","label","must","have","the","same","spatial","shape",",","however","some","public","datasets","are","having","slight","shape","mismatches",",","which","will","cause","potential","crashes","when","calculating","loss","or","metric","functions","."]
code: def __call__(
      self, data: Mapping[Hashable, torch.Tensor]
  ) -> dict[Hashable, torch.Tensor]:
      d = dict(data)
      image_shape = d[self.source_key].shape[1:]
      for key in self.key_iterator(d):
          label_shape = d[key].shape[1:]
          if label_shape != image_shape:
              filename = ""
              if hasattr(d[key], "meta") and isinstance(d[key].meta, Mapping):  # type: ignore[attr-defined]
                  filename = d[key].meta.get(ImageMetaKey.FILENAME_OR_OBJ)  # type: ignore[attr-defined]
  
              if np.allclose(
                  list(label_shape),
                  list(image_shape),
                  atol=self.allowed_shape_difference,
              ):
                  if self.warn:
                      warnings.warn(
                          f"The {key} with shape {label_shape} was resized to match the source shape {image_shape}"
                          f", the metadata was not updated {filename}."
                      )
                  d[key] = torch.nn.functional.interpolate(
                      input=d[key].unsqueeze(0),
                      size=image_shape,
                      mode="nearest-exact"
                      if pytorch_after(1, 11)
                      else "nearest",
                  ).squeeze(0)
              else:
                  raise ValueError(
                      f"The {key} shape {label_shape} is different from the source shape {image_shape} {filename}."
                  )
      return d
  
file_path: MONAI/monai/apps/auto3dseg/transforms.py
imports: from __future__ import annotations
  import warnings
  from collections.abc import Hashable, Mapping
  import numpy
  import torch
  from monai.config import KeysCollection
  from monai.networks.utils import pytorch_after
  from monai.transforms import MapTransform
  from monai.utils.misc import ImageMetaKey
label_desc: Use image node_id 2 for calling the EnsureSameShaped obj's underlying member method code with example usage: obj.__call__(data) and returns: d