code: def _scipy_dice(
      preds: Tensor,
      target: Tensor,
      ignore_index: Optional[int] = None,
  ) -> float:
      """Compute dice score from prediction and target. Used scipy implementation of main dice logic.
  
      Args:
          preds: prediction tensor
          target: target tensor
          ignore_index:
              Integer specifying a target class to ignore. Recommend set to index of background class.
  
      Return:
          Float dice score
  
      """
      sk_preds, sk_target, mode = _input_format_classification(
          preds, target
      )
  
      if ignore_index is not None and mode != DataType.BINARY:
          sk_preds = _del_column(sk_preds, ignore_index)
          sk_target = _del_column(sk_target, ignore_index)
  
      sk_preds, sk_target = sk_preds.numpy(), sk_target.numpy()
  
      return 1 - sc_dice(sk_preds.reshape(-1), sk_target.reshape(-1))
  
imports: from functools import partial
  from typing import Optional
  import pytest
  from scipy.spatial.distance import dice
  from torch import Tensor, tensor
  from torchmetrics.classification import Dice
  from torchmetrics.functional import dice
  from torchmetrics.functional.classification.stat_scores import _del_column
  from torchmetrics.utilities.checks import _input_format_classification
  from torchmetrics.utilities.enums import DataType
  from unittests.classification.inputs import _input_binary, _input_binary_logits, _input_binary_prob
  from unittests.classification.inputs import _input_multiclass
  from unittests.classification.inputs import _input_multiclass_logits
  from unittests.classification.inputs import _input_multiclass_prob
  from unittests.classification.inputs import _input_multiclass_with_missing_class
  from unittests.classification.inputs import _input_multilabel
  from unittests.classification.inputs import _input_multilabel_logits
  from unittests.classification.inputs import _input_multilabel_multidim
  from unittests.classification.inputs import _input_multilabel_multidim_prob
  from unittests.classification.inputs import _input_multilabel_prob
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 1 for calling a global function with example usage: _scipy_dice(preds, target, ignore_index) and returns: unknown