class_docstr: Calculate critical success index (CSI).
  
  Critical success index (also known as the threat score) is a statistic used weather forecasting that measures
  forecast performance over inputs binarized at a specified threshold. It is defined as:
  
  .. math:: \text{CSI} = \frac{\text{TP}}{\text{TP}+\text{FN}+\text{FP}}
  
  Where :math:`\text{TP}`, :math:`\text{FN}` and :math:`\text{FP}` represent the number of true positives, false
  negatives and false positives respectively after binarizing the input tensors.
  
  Args:
      threshold: Values above or equal to threshold are replaced with 1, below by 0
      keep_sequence_dim: Index of the sequence dimension if the inputs are sequences of images. If specified,
          the score will be calculated separately for each image in the sequence. If ``None``, the score will be
          calculated across all dimensions.
  
  Example:
      >>> import torch
      >>> from torchmetrics.regression import CriticalSuccessIndex
      >>> x = torch.Tensor([[0.2, 0.7], [0.9, 0.3]])
      >>> y = torch.Tensor([[0.4, 0.2], [0.8, 0.6]])
      >>> csi = CriticalSuccessIndex(0.5)
      >>> csi(x, y)
      tensor(0.3333)
  
  Example:
      >>> import torch
      >>> from torchmetrics.regression import CriticalSuccessIndex
      >>> x = torch.Tensor([[[0.2, 0.7], [0.9, 0.3]], [[0.2, 0.7], [0.9, 0.3]]])
      >>> y = torch.Tensor([[[0.4, 0.2], [0.8, 0.6]], [[0.4, 0.2], [0.8, 0.6]]])
      >>> csi = CriticalSuccessIndex(0.5, keep_sequence_dim=0)
      >>> csi(x, y)
      tensor([0.3333, 0.3333])
docstr: Compute critical success index over state.
code: def compute(self) -> torch.Tensor:
      """Compute critical success index over state."""
      if self.keep_sequence_dim is None:
          hits = self.hits
          misses = self.misses
          false_alarms = self.false_alarms
      else:
          hits = dim_zero_cat(self.hits_list)
          misses = dim_zero_cat(self.misses_list)
          false_alarms = dim_zero_cat(self.false_alarms_list)
      return _critical_success_index_compute(hits, misses, false_alarms)
  
file_path: torchmetrics/src/torchmetrics/regression/csi.py
imports: from typing import Any, List, Optional
  import torch
  from torchmetrics.functional.regression.csi import _critical_success_index_compute, _critical_success_index_update
  from torchmetrics.metric import Metric
  from torchmetrics.utilities import dim_zero_cat
label_desc: Use image node_id 3 for calling the CriticalSuccessIndex obj's underlying member method code with example usage: obj.compute() and returns: _critical_success_index_compute