code: def test_single_sample_update():
      """See issue: https://github.com/Lightning-AI/torchmetrics/issues/2014."""
      metric = PearsonCorrCoef()
  
      # Works
      metric(
          torch.tensor([3.0, -0.5, 2.0, 7.0]),
          torch.tensor([2.5, 0.0, 2.0, 8.0]),
      )
      res1 = metric.compute()
      metric.reset()
  
      metric(torch.tensor([3.0]), torch.tensor([2.5]))
      metric(torch.tensor([-0.5]), torch.tensor([0.0]))
      metric(torch.tensor([2.0]), torch.tensor([2.0]))
      metric(torch.tensor([7.0]), torch.tensor([8.0]))
      res2 = metric.compute()
      assert torch.allclose(res1, res2)
  
imports: from functools import partial
  import pytest
  import torch
  from scipy.stats import pearsonr
  from torchmetrics.functional.regression.pearson import pearson_corrcoef
  from torchmetrics.regression.pearson import PearsonCorrCoef, _final_aggregation
  from unittests import BATCH_SIZE, EXTRA_DIM, NUM_BATCHES, _Input
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 6 for calling a global function with example usage: test_single_sample_update() without return types