code: def _get_target_details(
      targets: List[Any],
      target_formatter_type: Type[TargetFormatter],
  ) -> Tuple[Optional[List[Any]], int]:
      """Given a list of targets and their ``TargetFormatter`` type, this function determines the ``labels`` and
      ``num_classes``. Targets can be:
  
      * Token-based: ``labels`` is the unique tokens, ``num_classes`` is the number of unique tokens.
      * Numeric: ``labels`` is ``None`` and ``num_classes`` is the maximum value plus one.
      * Binary: ``labels`` is ``None`` and ``num_classes`` is the length of the binary target.
  
      Args:
          targets: A list of targets.
          target_formatter_type: The ``TargetFormatter`` type.
  
      Returns:
          (labels, num_classes): Tuple containing the inferred ``labels`` (or ``None`` if no labels could be inferred)
          and ``num_classes``.
  
      """
      targets = _as_list(targets)
      if target_formatter_type.numeric:
          # Take a max over all values
          if target_formatter_type is MultiNumericTargetFormatter:
              values = []
              for target in targets:
                  values.extend(target)
          else:
              values = targets
          num_classes = _as_list(max(values))
          if _is_list_like(num_classes):
              num_classes = num_classes[0]
          num_classes = num_classes + 1
          labels = None
      elif target_formatter_type.binary or (
          target_formatter_type is MultiSoftTargetFormatter
      ):
          # Take a length
          # TODO: Add a check here and error if target lengths are not all equal
          num_classes = len(targets[0])
          labels = None
      else:
          # Compute tokens
          tokens = []
          if (
              target_formatter_type
              is CommaDelimitedMultiLabelTargetFormatter
          ):
              for target in targets:
                  tokens.extend(target.split(","))
          elif target_formatter_type is SpaceDelimitedTargetFormatter:
              for target in targets:
                  tokens.extend(target.split(" "))
          elif target_formatter_type is MultiLabelTargetFormatter:
              for target in targets:
                  tokens.extend(target)
          else:
              tokens = targets
  
          tokens = [_strip(token) for token in tokens]
          labels = list(sorted_alphanumeric(set(tokens)))
          num_classes = None
      return labels, num_classes
  
imports: from dataclasses import dataclass
  from functools import reduce
  from typing import Any, ClassVar, Dict, List, Optional, Tuple, Type, Union, cast
  import numpy
  import torch
  from torch import Tensor
  from flash.core.data.utilities.sort import sorted_alphanumeric
  from flash.core.utilities.imports import _TOPIC_CORE_AVAILABLE
label_desc: Use image node_id 6 for calling a global function with example usage: _get_target_details(targets, target_formatter_type) and returns: labels,  num_classes