code: def _test_distrib_compute(device):
      rank = idist.get_rank()
  
      def _test(metric_device):
          metric_device = torch.device(metric_device)
          m = GeometricMeanRelativeAbsoluteError(device=metric_device)
  
          y_pred = torch.rand(size=(100,), device=device)
          y = torch.rand(size=(100,), device=device)
  
          m.update((y_pred, y))
  
          y_pred = idist.all_gather(y_pred)
          y = idist.all_gather(y)
  
          np_y = y.cpu().numpy()
          np_y_pred = y_pred.cpu().numpy()
  
          np_gmrae = np.exp(
              np.log(
                  np.abs(np_y - np_y_pred) / np.abs(np_y - np_y.mean())
              ).mean()
          )
  
          assert m.compute() == pytest.approx(np_gmrae, rel=1e-4)
  
      for i in range(3):
          torch.manual_seed(12 + rank + i)
          _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 GeometricMeanRelativeAbsoluteError
  from ignite.engine import Engine
  from ignite.exceptions import NotComputableError
label_desc: Use image node_id 5 for calling a global function with example usage: _test_distrib_compute(device) without return types