class_docstr: Compute Surface Distance between two tensors. It can support both multi-classes and multi-labels tasks.
  It supports both symmetric and asymmetric surface distance calculation.
  Input `y_pred` is compared with ground truth `y`.
  `y_preds` is expected to have binarized predictions and `y` should be in one-hot format.
  You can use suitable transforms in ``monai.transforms.post`` first to achieve binarized values.
  `y_preds` and `y` can be a list of channel-first Tensor (CHW[D]) or a batch-first Tensor (BCHW[D]).
  
  Example of the typical execution steps of this metric class follows :py:class:`monai.metrics.metric.Cumulative`.
  
  Args:
      include_background: whether to include distance computation on the first channel of
          the predicted output. Defaults to ``False``.
      symmetric: whether to calculate the symmetric average surface distance between
          `seg_pred` and `seg_gt`. Defaults to ``False``.
      distance_metric: : [``"euclidean"``, ``"chessboard"``, ``"taxicab"``]
          the metric used to compute surface distance. Defaults to ``"euclidean"``.
      reduction: define mode of reduction to the metrics, will only apply reduction on `not-nan` values,
          available reduction modes: {``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,
          ``"mean_channel"``, ``"sum_channel"``}, default to ``"mean"``. if "none", will not do reduction.
      get_not_nans: whether to return the `not_nans` count, if True, aggregate() returns (metric, not_nans).
          Here `not_nans` count the number of not nans for the metric, thus its shape equals to the shape of the metric.
docstr: Args:
      y_pred: input data to compute, typical segmentation model output.
          It must be one-hot format and first dim is batch, example shape: [16, 3, 32, 32]. The values
          should be binarized.
      y: ground truth to compute the distance. It must be one-hot format and first dim is batch.
          The values should be binarized.
      kwargs: additional parameters, e.g. ``spacing`` should be passed to correctly compute the metric.
          ``spacing``: spacing of pixel (or voxel). This parameter is relevant only
          if ``distance_metric`` is set to ``"euclidean"``.
          If a single number, isotropic spacing with that value is used for all images in the batch. If a sequence of numbers,
          the length of the sequence must be equal to the image dimensions.
          This spacing will be used for all images in the batch.
          If a sequence of sequences, the length of the outer sequence must be equal to the batch size.
          If inner sequence has length 1, isotropic spacing with that value is used for all images in the batch,
          else the inner sequence length must be equal to the image dimensions. If ``None``, spacing of unity is used
          for all images in batch. Defaults to ``None``.
  
  Raises:
      ValueError: when `y_pred` has less than three dimensions.
docstr_tok: ["Args",":","y_pred",":","input","data","to","compute",",","typical","segmentation","model","output",".","It","must","be","one-hot","format","and","first","dim","is","batch",",","example","shape",":","[","16",",","3",",","32",",","32","]",".","The","values","should","be","binarized",".","y",":","ground","truth","to","compute","the","distance",".","It","must","be","one-hot","format","and","first","dim","is","batch",".","The","values","should","be","binarized",".","kwargs",":","additional","parameters",",","e.g",".","``","spacing","``","should","be","passed","to","correctly","compute","the","metric",".","``","spacing","``",":","spacing","of","pixel","(","or","voxel",")",".","This","parameter","is","relevant","only","if","``","distance_metric","``","is","set","to","``","``","euclidean","''","``",".","If","a","single","number",",","isotropic","spacing","with","that","value","is","used","for","all","images","in","the","batch",".","If","a","sequence","of","numbers",",","the","length","of","the","sequence","must","be","equal","to","the","image","dimensions",".","This","spacing","will","be","used","for","all","images","in","the","batch",".","If","a","sequence","of","sequences",",","the","length","of","the","outer","sequence","must","be","equal","to","the","batch","size",".","If","inner","sequence","has","length","1",",","isotropic","spacing","with","that","value","is","used","for","all","images","in","the","batch",",","else","the","inner","sequence","length","must","be","equal","to","the","image","dimensions",".","If","``","None","``",",","spacing","of","unity","is","used","for","all","images","in","batch",".","Defaults","to","``","None","``",".","Raises",":","ValueError",":","when","`","y_pred","`","has","less","than","three","dimensions","."]
code: def _compute_tensor(self, y_pred: torch.Tensor, y: torch.Tensor, **kwargs: Any) -> torch.Tensor:  # type: ignore[override]
      """
      Args:
          y_pred: input data to compute, typical segmentation model output.
              It must be one-hot format and first dim is batch, example shape: [16, 3, 32, 32]. The values
              should be binarized.
          y: ground truth to compute the distance. It must be one-hot format and first dim is batch.
              The values should be binarized.
          kwargs: additional parameters, e.g. ``spacing`` should be passed to correctly compute the metric.
              ``spacing``: spacing of pixel (or voxel). This parameter is relevant only
              if ``distance_metric`` is set to ``"euclidean"``.
              If a single number, isotropic spacing with that value is used for all images in the batch. If a sequence of numbers,
              the length of the sequence must be equal to the image dimensions.
              This spacing will be used for all images in the batch.
              If a sequence of sequences, the length of the outer sequence must be equal to the batch size.
              If inner sequence has length 1, isotropic spacing with that value is used for all images in the batch,
              else the inner sequence length must be equal to the image dimensions. If ``None``, spacing of unity is used
              for all images in batch. Defaults to ``None``.
  
      Raises:
          ValueError: when `y_pred` has less than three dimensions.
      """
      if y_pred.dim() < 3:
          raise ValueError(
              "y_pred should have at least three dimensions."
          )
  
      # compute (BxC) for each channel for each batch
      return compute_average_surface_distance(
          y_pred=y_pred,
          y=y,
          include_background=self.include_background,
          symmetric=self.symmetric,
          distance_metric=self.distance_metric,
          spacing=kwargs.get("spacing"),
      )
  
file_path: MONAI/monai/metrics/surface_distance.py
imports: from __future__ import annotations
  from collections.abc import Sequence
  from typing import Any
  import numpy
  import torch
  from monai.metrics.utils import do_metric_reduction, get_edge_surface_distance, ignore_background, prepare_spacing
  from monai.utils import MetricReduction, convert_data_type
  from .metric import CumulativeIterationMetric
label_desc: Use image node_id 2 for calling the SurfaceDistanceMetric obj's underlying member method code with example usage: obj._compute_tensor(y_pred, y) and returns: compute_average_surface_distance