code: def _get_metric_metadata(
      preds: Tensor, target: Tensor, variant: _MetricVariant
  ) -> Tuple[
      Tensor,
      Tensor,
      Optional[Tensor],
      Optional[Tensor],
      Optional[Tensor],
      Optional[Tensor],
      Optional[Tensor],
      Optional[Tensor],
      Tensor,
  ]:
      """Obtain statistics to calculate metric value."""
      preds, target = _sort_on_first_sequence(preds, target)
  
      concordant_pairs = _count_concordant_pairs(preds, target)
      discordant_pairs = _count_discordant_pairs(preds, target)
  
      n_total = torch.tensor(preds.shape[0], device=preds.device)
      preds_ties = target_ties = None
      preds_ties_p1 = (
          preds_ties_p2
      ) = target_ties_p1 = target_ties_p2 = None
      if variant != _MetricVariant.A:
          preds = _convert_sequence_to_dense_rank(preds)
          target = _convert_sequence_to_dense_rank(target, sort=True)
          preds_ties, preds_ties_p1, preds_ties_p2 = _get_ties(preds)
          target_ties, target_ties_p1, target_ties_p2 = _get_ties(
              target
          )
      return (
          concordant_pairs,
          discordant_pairs,
          preds_ties,
          preds_ties_p1,
          preds_ties_p2,
          target_ties,
          target_ties_p1,
          target_ties_p2,
          n_total,
      )
  
imports: from typing import List, Optional, Tuple, Union
  import torch
  from torch import Tensor
  from typing_extensions import Literal
  from torchmetrics.functional.regression.utils import _check_data_shape_to_num_outputs
  from torchmetrics.utilities.checks import _check_same_shape
  from torchmetrics.utilities.data import _bincount, _cumsum, dim_zero_cat
  from torchmetrics.utilities.enums import EnumStr
label_desc: Use image node_id 8 for calling a global function with example usage: _get_metric_metadata(preds, target, variant) and returns: concordant_pairs,  discordant_pairs,  preds_ties,  preds_ties_p1,  preds_ties_p2,  target_ties,  target_ties_p1,  target_ties_p2,  n_total