code: def compute_f_beta_score(
      confusion_matrix: torch.Tensor, beta: float
  ) -> torch.Tensor:
      input_dim = confusion_matrix.ndimension()
      if input_dim == 1:
          confusion_matrix = confusion_matrix.unsqueeze(dim=0)
      if confusion_matrix.shape[-1] != 4:
          raise ValueError(
              "the size of the last dimension of confusion_matrix should be 4."
          )
  
      tp = confusion_matrix[..., 0]
      fp = confusion_matrix[..., 1]
      # tn = confusion_matrix[..., 2]
      fn = confusion_matrix[..., 3]
  
      nan_tensor = torch.tensor(
          float("nan"), device=confusion_matrix.device
      )
      numerator, denominator = (1.0 + beta**2) * tp, (
          (1.0 + beta**2) * tp + beta**2 * fn + fp
      )
  
      if isinstance(denominator, torch.Tensor):
          return torch.where(
              denominator != 0, numerator / denominator, nan_tensor
          )
      return numerator / denominator
  
file_path: MONAI/monai/metrics/f_beta_score.py
imports: from __future__ import annotations
  from collections.abc import Sequence
  import torch
  from monai.metrics.utils import do_metric_reduction, ignore_background
  from monai.utils import MetricReduction
  from .metric import CumulativeIterationMetric
label_desc: Use image node_id 2 for calling a global function with example usage: compute_f_beta_score(confusion_matrix, beta) and returns: unknown, torch