code: def test_final_aggregation_function(shapes):
      """Test that final aggregation function can take various shapes of input."""
      input_fn = lambda: torch.rand(shapes)
      output = _final_aggregation(
          input_fn(),
          input_fn(),
          input_fn(),
          input_fn(),
          input_fn(),
          torch.randint(10, shapes),
      )
      assert all(isinstance(out, torch.Tensor) for out in output)
      assert all(out.ndim == input_fn().ndim - 1 for out in output)
  
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 4 for calling a global function with example usage: test_final_aggregation_function(shapes) without return types