code: def _test_sync_on_compute_list_state(rank, sync_on_compute):
      dummy = DummyListMetric(sync_on_compute=sync_on_compute)
      dummy.update(tensor(rank + 1))
      val = dummy.compute()
      if sync_on_compute:
          assert val.sum() == 3
          assert torch.allclose(val, tensor([1, 2])) or torch.allclose(
              val, tensor([2, 1])
          )
      else:
          assert val == [tensor(rank + 1)]
  
imports: import os
  import sys
  from copy import deepcopy
  from functools import partial
  import pytest
  import torch
  from torch import tensor
  from torchmetrics import Metric
  from torchmetrics.utilities.distributed import gather_all_tensors
  from torchmetrics.utilities.exceptions import TorchMetricsUserError
  from unittests import NUM_PROCESSES
  from unittests.helpers import seed_all
  from unittests.helpers.testers import DummyListMetric, DummyMetric, DummyMetricSum
label_desc: Use image node_id 13 for calling a global function with example usage: _test_sync_on_compute_list_state(rank, sync_on_compute) without return types