code: def fbeta_score(
      preds: Tensor,
      target: Tensor,
      task: Literal["binary", "multiclass", "multilabel"],
      beta: float = 1.0,
      threshold: float = 0.5,
      num_classes: Optional[int] = None,
      num_labels: Optional[int] = None,
      average: Optional[
          Literal["micro", "macro", "weighted", "none"]
      ] = "micro",
      multidim_average: Optional[
          Literal["global", "samplewise"]
      ] = "global",
      top_k: Optional[int] = 1,
      ignore_index: Optional[int] = None,
      validate_args: bool = True,
  ) -> Tensor:
      r"""Compute `F-score`_ metric.
  
      .. math::
          F_{\beta} = (1 + \beta^2) * \frac{\text{precision} * \text{recall}}
          {(\beta^2 * \text{precision}) + \text{recall}}
  
      This function is a simple wrapper to get the task specific versions of this metric, which is done by setting the
      ``task`` argument to either ``'binary'``, ``'multiclass'`` or ``multilabel``. See the documentation of
      :func:`~torchmetrics.functional.classification.binary_fbeta_score`,
      :func:`~torchmetrics.functional.classification.multiclass_fbeta_score` and
      :func:`~torchmetrics.functional.classification.multilabel_fbeta_score` for the specific
      details of each argument influence and examples.
  
      Legacy Example:
          >>> from torch import tensor
          >>> target = tensor([0, 1, 2, 0, 1, 2])
          >>> preds = tensor([0, 2, 1, 0, 0, 1])
          >>> fbeta_score(preds, target, task="multiclass", num_classes=3, beta=0.5)
          tensor(0.3333)
  
      """
      task = ClassificationTask.from_str(task)
      assert (
          multidim_average is not None
      )  # noqa: S101  # needed for mypy
      if task == ClassificationTask.BINARY:
          return binary_fbeta_score(
              preds,
              target,
              beta,
              threshold,
              multidim_average,
              ignore_index,
              validate_args,
          )
      if task == ClassificationTask.MULTICLASS:
          if not isinstance(num_classes, int):
              raise ValueError(
                  f"`num_classes` is expected to be `int` but `{type(num_classes)} was passed.`"
              )
          if not isinstance(top_k, int):
              raise ValueError(
                  f"`top_k` is expected to be `int` but `{type(top_k)} was passed.`"
              )
          return multiclass_fbeta_score(
              preds,
              target,
              beta,
              num_classes,
              average,
              top_k,
              multidim_average,
              ignore_index,
              validate_args,
          )
      if task == ClassificationTask.MULTILABEL:
          if not isinstance(num_labels, int):
              raise ValueError(
                  f"`num_labels` is expected to be `int` but `{type(num_labels)} was passed.`"
              )
          return multilabel_fbeta_score(
              preds,
              target,
              beta,
              num_labels,
              threshold,
              average,
              multidim_average,
              ignore_index,
              validate_args,
          )
      raise ValueError(f"Unsupported task `{task}` passed.")
  
file_path: torchmetrics/src/torchmetrics/functional/classification/f_beta.py
imports: from typing import Optional
  from torch import Tensor
  from typing_extensions import Literal
  from torchmetrics.functional.classification.stat_scores import _binary_stat_scores_arg_validation, _binary_stat_scores_format, _binary_stat_scores_tensor_validation, _binary_stat_scores_update, _multiclass_stat_scores_arg_validation, _multiclass_stat_scores_format, _multiclass_stat_scores_tensor_validation, _multiclass_stat_scores_update, _multilabel_stat_scores_arg_validation, _multilabel_stat_scores_format, _multilabel_stat_scores_tensor_validation, _multilabel_stat_scores_update
  from torchmetrics.utilities.compute import _adjust_weights_safe_divide, _safe_divide
  from torchmetrics.utilities.enums import ClassificationTask
label_desc: Use image node_id 11 for calling a global function with example usage: fbeta_score(preds, target, task, beta, threshold, num_classes, num_labels, average, multidim_average, top_k, ignore_index, validate_args) and returns: binary_fbeta_score, multiclass_fbeta_score, multilabel_fbeta_score