code: def test_mask_edges(cases, spacing, crop, device):
      """Test the mask edges function."""
      if device == "cuda" and not torch.cuda.is_available():
          pytest.skip("CUDA device not available.")
      preds, target = cases
      if spacing is not None:
          spacing = preds.ndim * (spacing,)
      res = mask_edges(
          preds.to(device),
          target.to(device),
          spacing=spacing,
          crop=crop,
      )
      reference_res = monai_get_mask_edges(
          preds, target, spacing=spacing, crop=crop
      )
  
      for r1, r2 in zip(res, reference_res):
          assert torch.allclose(
              r1.cpu().float(), torch.from_numpy(r2).float()
          )
  
file_path: torchmetrics/tests/unittests/segmentation/test_utils.py
imports: import pytest
  import torch
  from monai.metrics.utils import get_code_to_measure_table
  from monai.metrics.utils import get_mask_edges
  from monai.metrics.utils import get_surface_distance
  from scipy.ndimage import binary_erosion
  from scipy.ndimage import distance_transform_cdt
  from scipy.ndimage import distance_transform_edt
  from scipy.ndimage import generate_binary_structure
  from torchmetrics.functional.segmentation.utils import binary_erosion, distance_transform, generate_binary_structure, get_neighbour_tables, mask_edges, surface_distance
label_desc: Use image node_id 7 for calling a global function with example usage: test_mask_edges(cases, spacing, crop, device) without return types