code: def _test_distrib_compute(device):
      def _test(metric_device):
          metric_device = torch.device(metric_device)
          m = MedianRelativeAbsoluteError(device=metric_device)
          torch.manual_seed(10 + rank)
  
          size = 151
  
          y_pred = torch.randint(
              1, 10, size=(size, 1), dtype=torch.double, device=device
          )
          y = torch.randint(
              1, 10, size=(size, 1), dtype=torch.double, device=device
          )
  
          m.update((y_pred, y))
  
          # gather y_pred, y
          y_pred = idist.all_gather(y_pred)
          y = idist.all_gather(y)
  
          np_y_pred = y_pred.cpu().numpy().ravel()
          np_y = y.cpu().numpy().ravel()
  
          res = m.compute()
  
          e = np.abs(np_y - np_y_pred) / np.abs(np_y - np_y.mean())
  
          np_res = np.median(e)
          assert pytest.approx(res) == np_res
  
      rank = idist.get_rank()
      for _ in range(3):
          _test("cpu")
          if device.type != "xla":
              _test(idist.device())
  
imports: import os
  import numpy
  import pytest
  import torch
  import ignite.distributed
  from ignite.contrib.metrics.regression import MedianRelativeAbsoluteError
  from ignite.engine import Engine
  from ignite.exceptions import NotComputableError
label_desc: Use image node_id 6 for calling a global function with example usage: _test_distrib_compute(device) without return types