code: def _count_discordant_pairs(preds: Tensor, target: Tensor) -> Tensor:
      """Count a total number of discordant pairs in given sequences."""
      return torch.cat(
          [
              _discordant_element_sum(preds, target, i)
              for i in range(preds.shape[0])
          ]
      ).sum(0)
  
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 5 for calling a global function with example usage: _count_discordant_pairs(preds, target) and returns: torch