code: def table_surface_area(
      spacing: Tuple[int, int, int],
      device: Optional[torch.device] = None,
  ) -> Tuple[Tensor, Tensor]:
      """Create a table that maps neighbour codes to the surface area of the corresponding surface.
  
      Adopted from:
      https://github.com/deepmind/surface-distance/blob/master/surface_distance/lookup_tables.py
  
      Args:
          spacing: The spacing between pixels along each spatial dimension. Should be a tuple of length 3.
          device: The device on which the table should be created.
  
      Returns:
          A tuple containing as its first element the table that maps neighbour codes to the surface area of the
          corresponding surface and as its second element the kernel used to compute the neighbour codes.
  
      Example::
          >>> from torchmetrics.functional.segmentation.utils import table_surface_area
          >>> table, kernel = table_surface_area((2,2,2))
          >>> table
          tensor([0.0000, 0.8660, 0.8660, 2.8284, 0.8660, 2.8284, 1.7321, 4.5981, 0.8660,
                  1.7321, 2.8284, 4.5981, 2.8284, 4.5981, 4.5981, 4.0000, 0.8660, 2.8284,
                  1.7321, 4.5981, 1.7321, 4.5981, 2.5981, 5.1962, 1.7321, 3.6945, 3.6945,
                  6.2925, 3.6945, 6.2925, 5.4641, 4.5981, 0.8660, 1.7321, 2.8284, 4.5981,
                  1.7321, 3.6945, 3.6945, 6.2925, 1.7321, 2.5981, 4.5981, 5.1962, 3.6945,
                  5.4641, 6.2925, 4.5981, 2.8284, 4.5981, 4.5981, 4.0000, 3.6945, 6.2925,
                  5.4641, 4.5981, 3.6945, 5.4641, 6.2925, 4.5981, 5.6569, 3.6945, 3.6945,
                  2.8284, 0.8660, 1.7321, 1.7321, 3.6945, 2.8284, 4.5981, 3.6945, 6.2925,
                  1.7321, 2.5981, 3.6945, 5.4641, 4.5981, 5.1962, 6.2925, 4.5981, 2.8284,
                  4.5981, 3.6945, 6.2925, 4.5981, 4.0000, 5.4641, 4.5981, 3.6945, 5.4641,
                  5.6569, 3.6945, 6.2925, 4.5981, 3.6945, 2.8284, 1.7321, 2.5981, 3.6945,
                  5.4641, 3.6945, 5.4641, 5.6569, 3.6945, 2.5981, 3.4641, 5.4641, 2.5981,
                  5.4641, 2.5981, 3.6945, 1.7321, 4.5981, 5.1962, 6.2925, 4.5981, 6.2925,
                  4.5981, 3.6945, 2.8284, 5.4641, 2.5981, 3.6945, 1.7321, 3.6945, 1.7321,
                  1.7321, 0.8660, 0.8660, 1.7321, 1.7321, 3.6945, 1.7321, 3.6945, 2.5981,
                  5.4641, 2.8284, 3.6945, 4.5981, 6.2925, 4.5981, 6.2925, 5.1962, 4.5981,
                  1.7321, 3.6945, 2.5981, 5.4641, 2.5981, 5.4641, 3.4641, 2.5981, 3.6945,
                  5.6569, 5.4641, 3.6945, 5.4641, 3.6945, 2.5981, 1.7321, 2.8284, 3.6945,
                  4.5981, 6.2925, 3.6945, 5.6569, 5.4641, 3.6945, 4.5981, 5.4641, 4.0000,
                  4.5981, 6.2925, 3.6945, 4.5981, 2.8284, 4.5981, 6.2925, 5.1962, 4.5981,
                  5.4641, 3.6945, 2.5981, 1.7321, 6.2925, 3.6945, 4.5981, 2.8284, 3.6945,
                  1.7321, 1.7321, 0.8660, 2.8284, 3.6945, 3.6945, 5.6569, 4.5981, 6.2925,
                  5.4641, 3.6945, 4.5981, 5.4641, 6.2925, 3.6945, 4.0000, 4.5981, 4.5981,
                  2.8284, 4.5981, 6.2925, 5.4641, 3.6945, 5.1962, 4.5981, 2.5981, 1.7321,
                  6.2925, 3.6945, 3.6945, 1.7321, 4.5981, 2.8284, 1.7321, 0.8660, 4.5981,
                  5.4641, 6.2925, 3.6945, 6.2925, 3.6945, 3.6945, 1.7321, 5.1962, 2.5981,
                  4.5981, 1.7321, 4.5981, 1.7321, 2.8284, 0.8660, 4.0000, 4.5981, 4.5981,
                  2.8284, 4.5981, 2.8284, 1.7321, 0.8660, 4.5981, 1.7321, 2.8284, 0.8660,
                  2.8284, 0.8660, 0.8660, 0.0000])
          >>> kernel
          tensor([[[[[128,  64],
                     [ 32,  16]],
                    [[  8,   4],
                     [  2,   1]]]]])
  
      """
      if not isinstance(spacing, tuple) and len(spacing) != 3:
          raise ValueError("The spacing must be a tuple of length 3.")
  
      zeros = [0.0, 0.0, 0.0]
      table = torch.tensor(
          [
              [zeros, zeros, zeros, zeros],
              [[0.125, 0.125, 0.125], zeros, zeros, zeros],
              [[-0.125, -0.125, 0.125], zeros, zeros, zeros],
              [[-0.25, -0.25, 0.0], [0.25, 0.25, -0.0], zeros, zeros],
              [[0.125, -0.125, 0.125], zeros, zeros, zeros],
              [[-0.25, -0.0, -0.25], [0.25, 0.0, 0.25], zeros, zeros],
              [
                  [0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.5, 0.0, -0.0],
                  [0.25, 0.25, 0.25],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [[-0.125, 0.125, 0.125], zeros, zeros, zeros],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, 0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [[-0.25, 0.0, 0.25], [-0.25, 0.0, 0.25], zeros, zeros],
              [
                  [0.5, 0.0, 0.0],
                  [-0.25, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [[0.25, -0.25, 0.0], [0.25, -0.25, 0.0], zeros, zeros],
              [
                  [0.5, 0.0, 0.0],
                  [0.25, -0.25, 0.25],
                  [-0.125, 0.125, -0.125],
                  zeros,
              ],
              [
                  [-0.5, 0.0, 0.0],
                  [-0.25, 0.25, 0.25],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [[0.5, 0.0, 0.0], [0.5, 0.0, 0.0], zeros, zeros],
              [[0.125, -0.125, -0.125], zeros, zeros, zeros],
              [[0.0, -0.25, -0.25], [0.0, 0.25, 0.25], zeros, zeros],
              [
                  [-0.125, -0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.0, -0.5, 0.0],
                  [0.25, 0.25, 0.25],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.0, 0.0, -0.5],
                  [0.25, 0.25, 0.25],
                  [-0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [-0.125, -0.125, -0.125],
                  [-0.25, -0.25, -0.25],
                  [0.25, 0.25, 0.25],
                  [0.125, 0.125, 0.125],
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.0, -0.25, -0.25],
                  [0.0, 0.25, 0.25],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.25, 0.0, 0.25],
                  [-0.25, 0.0, 0.25],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.375, 0.375, 0.375],
                  [0.0, -0.25, 0.25],
                  [-0.25, 0.0, 0.25],
              ],
              [
                  [0.125, -0.125, -0.125],
                  [0.25, -0.25, 0.0],
                  [0.25, -0.25, 0.0],
                  zeros,
              ],
              [
                  [0.375, 0.375, 0.375],
                  [0.0, 0.25, -0.25],
                  [-0.125, -0.125, -0.125],
                  [-0.25, 0.25, 0.0],
              ],
              [
                  [-0.5, 0.0, 0.0],
                  [-0.125, -0.125, -0.125],
                  [-0.25, -0.25, -0.25],
                  [0.125, 0.125, 0.125],
              ],
              [
                  [-0.5, 0.0, 0.0],
                  [-0.125, -0.125, -0.125],
                  [-0.25, -0.25, -0.25],
                  zeros,
              ],
              [[0.125, -0.125, 0.125], zeros, zeros, zeros],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [[0.0, -0.25, 0.25], [0.0, 0.25, -0.25], zeros, zeros],
              [
                  [0.0, -0.5, 0.0],
                  [0.125, 0.125, -0.125],
                  [0.25, 0.25, -0.25],
                  zeros,
              ],
              [
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.125, -0.125, 0.125],
                  [-0.25, -0.0, -0.25],
                  [0.25, 0.0, 0.25],
                  zeros,
              ],
              [
                  [0.0, -0.25, 0.25],
                  [0.0, 0.25, -0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.375, -0.375, 0.375],
                  [-0.0, 0.25, 0.25],
                  [0.125, 0.125, -0.125],
                  [-0.25, -0.0, -0.25],
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.0, 0.0, 0.5],
                  [-0.25, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.25, 0.25, -0.25],
                  [0.25, 0.25, -0.25],
                  [0.125, 0.125, -0.125],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [0.125, -0.125, 0.125],
                  [0.25, -0.25, 0.0],
                  [0.25, -0.25, 0.0],
                  zeros,
              ],
              [
                  [0.5, 0.0, 0.0],
                  [0.25, -0.25, 0.25],
                  [-0.125, 0.125, -0.125],
                  [0.125, -0.125, 0.125],
              ],
              [
                  [0.0, 0.25, -0.25],
                  [0.375, -0.375, -0.375],
                  [-0.125, 0.125, 0.125],
                  [0.25, 0.25, 0.0],
              ],
              [
                  [-0.5, 0.0, 0.0],
                  [-0.25, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [[0.25, -0.25, 0.0], [-0.25, 0.25, 0.0], zeros, zeros],
              [
                  [0.0, 0.5, 0.0],
                  [-0.25, 0.25, 0.25],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [0.0, 0.5, 0.0],
                  [0.125, -0.125, 0.125],
                  [-0.25, 0.25, -0.25],
                  zeros,
              ],
              [[0.0, 0.5, 0.0], [0.0, -0.5, 0.0], zeros, zeros],
              [
                  [0.25, -0.25, 0.0],
                  [-0.25, 0.25, 0.0],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.375, -0.375, -0.375],
                  [-0.25, 0.0, 0.25],
                  [-0.125, -0.125, -0.125],
                  [-0.25, 0.25, 0.0],
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.0, -0.5, 0.0],
                  [-0.25, -0.25, -0.25],
                  [-0.125, -0.125, -0.125],
              ],
              [
                  [0.0, -0.5, 0.0],
                  [-0.25, -0.25, -0.25],
                  [-0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [0.25, -0.25, 0.0],
                  [-0.25, 0.25, 0.0],
                  zeros,
              ],
              [
                  [0.0, 0.5, 0.0],
                  [0.25, 0.25, -0.25],
                  [-0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [-0.375, 0.375, -0.375],
                  [-0.25, -0.25, 0.0],
                  [-0.125, 0.125, -0.125],
                  [-0.25, 0.0, 0.25],
              ],
              [
                  [0.0, 0.5, 0.0],
                  [0.25, 0.25, -0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.25, -0.25, 0.0],
                  [-0.25, 0.25, 0.0],
                  [0.25, -0.25, 0.0],
                  [0.25, -0.25, 0.0],
              ],
              [
                  [-0.25, -0.25, 0.0],
                  [-0.25, -0.25, 0.0],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [-0.25, -0.25, 0.0],
                  [-0.25, -0.25, 0.0],
                  zeros,
              ],
              [[-0.25, -0.25, 0.0], [-0.25, -0.25, 0.0], zeros, zeros],
              [[-0.125, -0.125, 0.125], zeros, zeros, zeros],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [-0.25, -0.25, 0.0],
                  [0.25, 0.25, -0.0],
                  zeros,
              ],
              [[0.0, -0.25, 0.25], [0.0, -0.25, 0.25], zeros, zeros],
              [
                  [0.0, 0.0, 0.5],
                  [0.25, -0.25, 0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.0, -0.25, 0.25],
                  [0.0, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.375, -0.375, 0.375],
                  [0.0, -0.25, -0.25],
                  [-0.125, 0.125, -0.125],
                  [0.25, 0.25, 0.0],
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [-0.125, 0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [-0.25, 0.0, 0.25],
                  [-0.25, 0.0, 0.25],
                  zeros,
              ],
              [
                  [0.5, 0.0, 0.0],
                  [-0.25, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [-0.0, 0.5, 0.0],
                  [-0.25, 0.25, -0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.25, 0.25, -0.25],
                  [-0.25, 0.25, -0.25],
                  [-0.125, 0.125, -0.125],
                  [-0.125, 0.125, -0.125],
              ],
              [
                  [-0.25, 0.0, -0.25],
                  [0.375, -0.375, -0.375],
                  [0.0, 0.25, -0.25],
                  [-0.125, 0.125, 0.125],
              ],
              [
                  [0.5, 0.0, 0.0],
                  [-0.25, 0.25, -0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [[-0.25, 0.0, 0.25], [0.25, 0.0, -0.25], zeros, zeros],
              [
                  [-0.0, 0.0, 0.5],
                  [-0.25, 0.25, 0.25],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [-0.25, 0.0, 0.25],
                  [0.25, 0.0, -0.25],
                  zeros,
              ],
              [
                  [-0.25, -0.0, -0.25],
                  [-0.375, 0.375, 0.375],
                  [-0.25, -0.25, 0.0],
                  [-0.125, 0.125, 0.125],
              ],
              [
                  [0.0, 0.0, -0.5],
                  [0.25, 0.25, -0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [[-0.0, 0.0, 0.5], [0.0, 0.0, 0.5], zeros, zeros],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, 0.125, 0.125],
                  [0.25, 0.25, 0.25],
                  [0.0, 0.0, 0.5],
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.25, 0.25, 0.25],
                  [0.0, 0.0, 0.5],
                  zeros,
              ],
              [
                  [-0.25, 0.0, 0.25],
                  [0.25, 0.0, -0.25],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.0, 0.0, 0.5],
                  [0.25, -0.25, 0.25],
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
              ],
              [
                  [-0.25, 0.0, 0.25],
                  [-0.25, 0.0, 0.25],
                  [-0.25, 0.0, 0.25],
                  [0.25, 0.0, -0.25],
              ],
              [
                  [0.125, -0.125, 0.125],
                  [0.25, 0.0, 0.25],
                  [0.25, 0.0, 0.25],
                  zeros,
              ],
              [
                  [0.25, 0.0, 0.25],
                  [-0.375, -0.375, 0.375],
                  [-0.25, 0.25, 0.0],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [-0.0, 0.0, 0.5],
                  [0.25, -0.25, 0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.25, 0.0, 0.25],
                  [0.25, 0.0, 0.25],
                  zeros,
              ],
              [[0.25, 0.0, 0.25], [0.25, 0.0, 0.25], zeros, zeros],
              [
                  [-0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [0.0, -0.25, 0.25],
                  [0.0, 0.25, -0.25],
                  zeros,
              ],
              [
                  [0.0, -0.5, 0.0],
                  [0.125, 0.125, -0.125],
                  [0.25, 0.25, -0.25],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [0.0, -0.25, 0.25],
                  [0.0, -0.25, 0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.0, 0.0, 0.5],
                  [0.25, -0.25, 0.25],
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
              ],
              [
                  [0.0, -0.25, 0.25],
                  [0.0, -0.25, 0.25],
                  [0.0, -0.25, 0.25],
                  [0.0, 0.25, -0.25],
              ],
              [
                  [0.0, 0.25, 0.25],
                  [0.0, 0.25, 0.25],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  [0.125, 0.125, 0.125],
              ],
              [
                  [-0.0, 0.0, 0.5],
                  [-0.25, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [-0.0, 0.5, 0.0],
                  [-0.25, 0.25, -0.25],
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
              ],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [0.0, -0.25, -0.25],
                  [0.0, 0.25, 0.25],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.5, 0.0, -0.0],
                  [0.25, -0.25, -0.25],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [-0.25, 0.25, 0.25],
                  [-0.125, 0.125, 0.125],
                  [-0.25, 0.25, 0.25],
                  [0.125, -0.125, -0.125],
              ],
              [
                  [0.375, -0.375, 0.375],
                  [0.0, 0.25, 0.25],
                  [-0.125, 0.125, -0.125],
                  [-0.25, 0.0, 0.25],
              ],
              [
                  [0.0, -0.5, 0.0],
                  [-0.25, 0.25, 0.25],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.375, -0.375, 0.375],
                  [0.25, -0.25, 0.0],
                  [0.0, 0.25, 0.25],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [-0.25, 0.25, 0.25],
                  [0.0, 0.0, 0.5],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.0, 0.25, 0.25],
                  [0.0, 0.25, 0.25],
                  zeros,
              ],
              [[0.0, 0.25, 0.25], [0.0, 0.25, 0.25], zeros, zeros],
              [
                  [0.5, 0.0, -0.0],
                  [0.25, 0.25, 0.25],
                  [0.125, 0.125, 0.125],
                  [0.125, 0.125, 0.125],
              ],
              [
                  [0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.25, -0.0, -0.25],
                  [0.25, 0.0, 0.25],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [-0.25, -0.25, 0.0],
                  [0.25, 0.25, -0.0],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, 0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [[0.125, 0.125, 0.125], zeros, zeros, zeros],
              [[0.125, 0.125, 0.125], zeros, zeros, zeros],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, 0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [-0.25, -0.25, 0.0],
                  [0.25, 0.25, -0.0],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [-0.25, -0.0, -0.25],
                  [0.25, 0.0, 0.25],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.5, 0.0, -0.0],
                  [0.25, 0.25, 0.25],
                  [0.125, 0.125, 0.125],
                  [0.125, 0.125, 0.125],
              ],
              [[0.0, 0.25, 0.25], [0.0, 0.25, 0.25], zeros, zeros],
              [
                  [0.125, 0.125, 0.125],
                  [0.0, 0.25, 0.25],
                  [0.0, 0.25, 0.25],
                  zeros,
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [-0.25, 0.25, 0.25],
                  [0.0, 0.0, 0.5],
                  zeros,
              ],
              [
                  [-0.375, -0.375, 0.375],
                  [0.25, -0.25, 0.0],
                  [0.0, 0.25, 0.25],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [0.0, -0.5, 0.0],
                  [-0.25, 0.25, 0.25],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.375, -0.375, 0.375],
                  [0.0, 0.25, 0.25],
                  [-0.125, 0.125, -0.125],
                  [-0.25, 0.0, 0.25],
              ],
              [
                  [-0.25, 0.25, 0.25],
                  [-0.125, 0.125, 0.125],
                  [-0.25, 0.25, 0.25],
                  [0.125, -0.125, -0.125],
              ],
              [
                  [0.5, 0.0, -0.0],
                  [0.25, -0.25, -0.25],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.0, -0.25, -0.25],
                  [0.0, 0.25, 0.25],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [-0.0, 0.5, 0.0],
                  [-0.25, 0.25, -0.25],
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [-0.0, 0.0, 0.5],
                  [-0.25, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  [0.125, 0.125, 0.125],
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.0, 0.25, 0.25],
                  [0.0, 0.25, 0.25],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [0.0, -0.25, -0.25],
                  [0.0, 0.25, 0.25],
                  [0.0, 0.25, 0.25],
                  [0.0, 0.25, 0.25],
              ],
              [
                  [0.0, 0.0, 0.5],
                  [0.25, -0.25, 0.25],
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
              ],
              [
                  [0.0, -0.25, 0.25],
                  [0.0, -0.25, 0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.0, -0.5, 0.0],
                  [0.125, 0.125, -0.125],
                  [0.25, 0.25, -0.25],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [0.0, -0.25, 0.25],
                  [0.0, 0.25, -0.25],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [[0.25, 0.0, 0.25], [0.25, 0.0, 0.25], zeros, zeros],
              [
                  [0.125, 0.125, 0.125],
                  [0.25, 0.0, 0.25],
                  [0.25, 0.0, 0.25],
                  zeros,
              ],
              [
                  [-0.0, 0.0, 0.5],
                  [0.25, -0.25, 0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.25, 0.0, 0.25],
                  [-0.375, -0.375, 0.375],
                  [-0.25, 0.25, 0.0],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [0.125, -0.125, 0.125],
                  [0.25, 0.0, 0.25],
                  [0.25, 0.0, 0.25],
                  zeros,
              ],
              [
                  [-0.25, -0.0, -0.25],
                  [0.25, 0.0, 0.25],
                  [0.25, 0.0, 0.25],
                  [0.25, 0.0, 0.25],
              ],
              [
                  [-0.0, 0.0, 0.5],
                  [0.25, -0.25, 0.25],
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
              ],
              [
                  [-0.25, 0.0, 0.25],
                  [0.25, 0.0, -0.25],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.25, 0.25, 0.25],
                  [0.0, 0.0, 0.5],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, 0.125, 0.125],
                  [0.25, 0.25, 0.25],
                  [0.0, 0.0, 0.5],
              ],
              [[-0.0, 0.0, 0.5], [0.0, 0.0, 0.5], zeros, zeros],
              [
                  [0.0, 0.0, -0.5],
                  [0.25, 0.25, -0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.25, -0.0, -0.25],
                  [-0.375, 0.375, 0.375],
                  [-0.25, -0.25, 0.0],
                  [-0.125, 0.125, 0.125],
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [-0.25, 0.0, 0.25],
                  [0.25, 0.0, -0.25],
                  zeros,
              ],
              [
                  [-0.0, 0.0, 0.5],
                  [-0.25, 0.25, 0.25],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [[-0.25, 0.0, 0.25], [0.25, 0.0, -0.25], zeros, zeros],
              [
                  [0.5, 0.0, 0.0],
                  [-0.25, 0.25, -0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.25, 0.0, -0.25],
                  [0.375, -0.375, -0.375],
                  [0.0, 0.25, -0.25],
                  [-0.125, 0.125, 0.125],
              ],
              [
                  [-0.25, 0.25, -0.25],
                  [-0.25, 0.25, -0.25],
                  [-0.125, 0.125, -0.125],
                  [-0.125, 0.125, -0.125],
              ],
              [
                  [-0.0, 0.5, 0.0],
                  [-0.25, 0.25, -0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.5, 0.0, 0.0],
                  [-0.25, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [-0.25, 0.0, 0.25],
                  [-0.25, 0.0, 0.25],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [-0.125, 0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.375, -0.375, 0.375],
                  [0.0, -0.25, -0.25],
                  [-0.125, 0.125, -0.125],
                  [0.25, 0.25, 0.0],
              ],
              [
                  [0.0, -0.25, 0.25],
                  [0.0, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.0, 0.0, 0.5],
                  [0.25, -0.25, 0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [[0.0, -0.25, 0.25], [0.0, -0.25, 0.25], zeros, zeros],
              [
                  [-0.125, -0.125, 0.125],
                  [-0.25, -0.25, 0.0],
                  [0.25, 0.25, -0.0],
                  zeros,
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [[-0.125, -0.125, 0.125], zeros, zeros, zeros],
              [[-0.25, -0.25, 0.0], [-0.25, -0.25, 0.0], zeros, zeros],
              [
                  [0.125, 0.125, 0.125],
                  [-0.25, -0.25, 0.0],
                  [-0.25, -0.25, 0.0],
                  zeros,
              ],
              [
                  [-0.25, -0.25, 0.0],
                  [-0.25, -0.25, 0.0],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.25, -0.25, 0.0],
                  [-0.25, -0.25, 0.0],
                  [-0.25, -0.25, 0.0],
                  [0.25, 0.25, -0.0],
              ],
              [
                  [0.0, 0.5, 0.0],
                  [0.25, 0.25, -0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.375, 0.375, -0.375],
                  [-0.25, -0.25, 0.0],
                  [-0.125, 0.125, -0.125],
                  [-0.25, 0.0, 0.25],
              ],
              [
                  [0.0, 0.5, 0.0],
                  [0.25, 0.25, -0.25],
                  [-0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [0.25, -0.25, 0.0],
                  [-0.25, 0.25, 0.0],
                  zeros,
              ],
              [
                  [0.0, -0.5, 0.0],
                  [-0.25, -0.25, -0.25],
                  [-0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.0, -0.5, 0.0],
                  [-0.25, -0.25, -0.25],
                  [-0.125, -0.125, -0.125],
              ],
              [
                  [-0.375, -0.375, -0.375],
                  [-0.25, 0.0, 0.25],
                  [-0.125, -0.125, -0.125],
                  [-0.25, 0.25, 0.0],
              ],
              [
                  [0.25, -0.25, 0.0],
                  [-0.25, 0.25, 0.0],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [[0.0, 0.5, 0.0], [0.0, -0.5, 0.0], zeros, zeros],
              [
                  [0.0, 0.5, 0.0],
                  [0.125, -0.125, 0.125],
                  [-0.25, 0.25, -0.25],
                  zeros,
              ],
              [
                  [0.0, 0.5, 0.0],
                  [-0.25, 0.25, 0.25],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [[0.25, -0.25, 0.0], [-0.25, 0.25, 0.0], zeros, zeros],
              [
                  [-0.5, 0.0, 0.0],
                  [-0.25, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.0, 0.25, -0.25],
                  [0.375, -0.375, -0.375],
                  [-0.125, 0.125, 0.125],
                  [0.25, 0.25, 0.0],
              ],
              [
                  [0.5, 0.0, 0.0],
                  [0.25, -0.25, 0.25],
                  [-0.125, 0.125, -0.125],
                  [0.125, -0.125, 0.125],
              ],
              [
                  [0.125, -0.125, 0.125],
                  [0.25, -0.25, 0.0],
                  [0.25, -0.25, 0.0],
                  zeros,
              ],
              [
                  [0.25, 0.25, -0.25],
                  [0.25, 0.25, -0.25],
                  [0.125, 0.125, -0.125],
                  [-0.125, -0.125, 0.125],
              ],
              [
                  [-0.0, 0.0, 0.5],
                  [-0.25, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [-0.375, -0.375, 0.375],
                  [-0.0, 0.25, 0.25],
                  [0.125, 0.125, -0.125],
                  [-0.25, -0.0, -0.25],
              ],
              [
                  [0.0, -0.25, 0.25],
                  [0.0, 0.25, -0.25],
                  [0.125, -0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, -0.125, 0.125],
                  [-0.25, -0.0, -0.25],
                  [0.25, 0.0, 0.25],
                  zeros,
              ],
              [
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.0, -0.5, 0.0],
                  [0.125, 0.125, -0.125],
                  [0.25, 0.25, -0.25],
                  zeros,
              ],
              [[0.0, -0.25, 0.25], [0.0, 0.25, -0.25], zeros, zeros],
              [
                  [0.125, 0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [[0.125, -0.125, 0.125], zeros, zeros, zeros],
              [
                  [-0.5, 0.0, 0.0],
                  [-0.125, -0.125, -0.125],
                  [-0.25, -0.25, -0.25],
                  zeros,
              ],
              [
                  [-0.5, 0.0, 0.0],
                  [-0.125, -0.125, -0.125],
                  [-0.25, -0.25, -0.25],
                  [0.125, 0.125, 0.125],
              ],
              [
                  [0.375, 0.375, 0.375],
                  [0.0, 0.25, -0.25],
                  [-0.125, -0.125, -0.125],
                  [-0.25, 0.25, 0.0],
              ],
              [
                  [0.125, -0.125, -0.125],
                  [0.25, -0.25, 0.0],
                  [0.25, -0.25, 0.0],
                  zeros,
              ],
              [
                  [0.125, 0.125, 0.125],
                  [0.375, 0.375, 0.375],
                  [0.0, -0.25, 0.25],
                  [-0.25, 0.0, 0.25],
              ],
              [
                  [-0.25, 0.0, 0.25],
                  [-0.25, 0.0, 0.25],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [0.0, -0.25, -0.25],
                  [0.0, 0.25, 0.25],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.125, 0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
                  zeros,
              ],
              [
                  [-0.125, -0.125, -0.125],
                  [-0.25, -0.25, -0.25],
                  [0.25, 0.25, 0.25],
                  [0.125, 0.125, 0.125],
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [0.0, 0.0, -0.5],
                  [0.25, 0.25, 0.25],
                  [-0.125, -0.125, -0.125],
                  zeros,
              ],
              [
                  [0.125, -0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
                  zeros,
              ],
              [
                  [0.0, -0.5, 0.0],
                  [0.25, 0.25, 0.25],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [-0.125, -0.125, 0.125],
                  [0.125, -0.125, -0.125],
                  zeros,
                  zeros,
              ],
              [[0.0, -0.25, -0.25], [0.0, 0.25, 0.25], zeros, zeros],
              [[0.125, -0.125, -0.125], zeros, zeros, zeros],
              [[0.5, 0.0, 0.0], [0.5, 0.0, 0.0], zeros, zeros],
              [
                  [-0.5, 0.0, 0.0],
                  [-0.25, 0.25, 0.25],
                  [-0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.5, 0.0, 0.0],
                  [0.25, -0.25, 0.25],
                  [-0.125, 0.125, -0.125],
                  zeros,
              ],
              [[0.25, -0.25, 0.0], [0.25, -0.25, 0.0], zeros, zeros],
              [
                  [0.5, 0.0, 0.0],
                  [-0.25, -0.25, 0.25],
                  [-0.125, -0.125, 0.125],
                  zeros,
              ],
              [[-0.25, 0.0, 0.25], [-0.25, 0.0, 0.25], zeros, zeros],
              [
                  [0.125, 0.125, 0.125],
                  [-0.125, 0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [[-0.125, 0.125, 0.125], zeros, zeros, zeros],
              [
                  [0.5, 0.0, -0.0],
                  [0.25, 0.25, 0.25],
                  [0.125, 0.125, 0.125],
                  zeros,
              ],
              [
                  [0.125, -0.125, 0.125],
                  [-0.125, -0.125, 0.125],
                  zeros,
                  zeros,
              ],
              [[-0.25, -0.0, -0.25], [0.25, 0.0, 0.25], zeros, zeros],
              [[0.125, 0.125, 0.125], zeros, zeros, zeros],
              [[-0.25, -0.25, 0.0], [0.25, 0.25, -0.0], zeros, zeros],
              [[0.125, 0.125, 0.125], zeros, zeros, zeros],
              [[0.125, 0.125, 0.125], zeros, zeros, zeros],
              [zeros, zeros, zeros, zeros],
          ],
          dtype=torch.float32,
          device=device,
      )
  
      space = torch.as_tensor(
          [
              [
                  [
                      spacing[1] * spacing[2],
                      spacing[0] * spacing[2],
                      spacing[0] * spacing[1],
                  ]
              ]
          ],
          device=device,
          dtype=table.dtype,
      )
      norm = torch.linalg.norm(table * space, dim=-1)
      table = norm.sum(-1)
      kernel = torch.as_tensor(
          [[[[[128, 64], [32, 16]], [[8, 4], [2, 1]]]]], device=device
      )
      return table, kernel
  
file_path: torchmetrics/src/torchmetrics/functional/segmentation/utils.py
imports: import functools
  import math
  from typing import List, Optional, Tuple, Union
  import torch
  from torch import Tensor
  from torch.nn.functional import conv2d, conv3d, pad, unfold
  from typing_extensions import Literal
  from torchmetrics.utilities.checks import _check_same_shape
  from torchmetrics.utilities.imports import _SCIPY_AVAILABLE
label_desc: Use image node_id 10 for calling a global function with example usage: table_surface_area(spacing, device) and returns: table,  kernel