code: def test_metric_collection(window):
      """Check that running metric works as expected for metric collections."""
      compare = MetricCollection(
          {"mse": MeanSquaredError(), "msa": MeanAbsoluteError()}
      )
      metric = MetricCollection(
          {
              "mse": Running(MeanSquaredError(), window=window),
              "msa": Running(MeanAbsoluteError(), window=window),
          }
      )
      preds = torch.rand(10, 20)
      target = torch.rand(10, 20)
  
      for i in range(10):
          p, t = preds[i], target[i]
          p_run, t_run = preds[
              max(i - (window - 1), 0) : i + 1, :
          ].reshape(-1), target[
              max(i - (window - 1), 0) : i + 1, :
          ].reshape(
              -1
          )
          metric.update(p, t)
  
          res1, res2 = compare(p_run, t_run), metric.compute()
          for key in res1:
              assert torch.allclose(res1[key], res2[key])
  
file_path: torchmetrics/tests/unittests/wrappers/test_running.py
imports: import sys
  from functools import partial
  import pytest
  import torch
  from torchmetrics.aggregation import MeanMetric, SumMetric
  from torchmetrics.classification import BinaryAccuracy, BinaryConfusionMatrix
  from torchmetrics.collections import MetricCollection
  from torchmetrics.regression import MeanAbsoluteError, MeanSquaredError, PearsonCorrCoef
  from torchmetrics.wrappers import Running
  from unittests import NUM_PROCESSES
  from unittests.helpers.utilities import no_warning_call
label_desc: Use image node_id 5 for calling a global function with example usage: test_metric_collection(window) without return types