code: def pearson_corrcoef(preds: Tensor, target: Tensor) -> Tensor:
      """Compute pearson correlation coefficient.
  
      Args:
          preds: estimated scores
          target: ground truth scores
  
      Example (single output regression):
          >>> from torchmetrics.functional.regression import pearson_corrcoef
          >>> target = torch.tensor([3, -0.5, 2, 7])
          >>> preds = torch.tensor([2.5, 0.0, 2, 8])
          >>> pearson_corrcoef(preds, target)
          tensor(0.9849)
  
      Example (multi output regression):
          >>> from torchmetrics.functional.regression import pearson_corrcoef
          >>> target = torch.tensor([[3, -0.5], [2, 7]])
          >>> preds = torch.tensor([[2.5, 0.0], [2, 8]])
          >>> pearson_corrcoef(preds, target)
          tensor([1., 1.])
  
      """
      d = preds.shape[1] if preds.ndim == 2 else 1
      _temp = torch.zeros(d, dtype=preds.dtype, device=preds.device)
      mean_x, mean_y, var_x = (
          _temp.clone(),
          _temp.clone(),
          _temp.clone(),
      )
      var_y, corr_xy, nb = _temp.clone(), _temp.clone(), _temp.clone()
      _, _, var_x, var_y, corr_xy, nb = _pearson_corrcoef_update(
          preds,
          target,
          mean_x,
          mean_y,
          var_x,
          var_y,
          corr_xy,
          nb,
          num_outputs=1 if preds.ndim == 1 else preds.shape[-1],
      )
      return _pearson_corrcoef_compute(var_x, var_y, corr_xy, nb)
  
file_path: torchmetrics/src/torchmetrics/functional/regression/pearson.py
imports: import math
  from typing import Tuple
  import torch
  from torch import Tensor
  from torchmetrics.functional.regression.utils import _check_data_shape_to_num_outputs
  from torchmetrics.utilities import rank_zero_warn
  from torchmetrics.utilities.checks import _check_same_shape
label_desc: Use image node_id 3 for calling a global function with example usage: pearson_corrcoef(preds, target) and returns: _pearson_corrcoef_compute