code: def _test_distrib_integration(device):
      from ignite.engine import Engine
  
      rank = idist.get_rank()
      torch.manual_seed(12)
  
      def _test(metric_device):
          n_iters = 60
          s = 16
          offset = n_iters * s
  
          n_probabilities = 10
          y = torch.rand(
              offset * idist.get_world_size(), n_probabilities
          )
  
          def update(_, i):
              return y[
                  i * s + rank * offset : (i + 1) * s + rank * offset, :
              ]
  
          engine = Engine(update)
          m = InceptionScore(
              num_features=n_probabilities,
              feature_extractor=torch.nn.Identity(),
              device=metric_device,
          )
          m.attach(engine, "InceptionScore")
  
          engine.run(data=list(range(n_iters)), max_epochs=1)
  
          assert "InceptionScore" in engine.state.metrics
  
          assert (
              pytest.approx(calculate_inception_score(y), rel=1e-5)
              == m.compute()
          )
  
      metric_devices = [torch.device("cpu")]
      if device.type != "xla":
          metric_devices.append(idist.device())
      for metric_device in metric_devices:
          _test(metric_device=metric_device)
  
file_path: ignite/tests/ignite/metrics/gan/test_inception_score.py
imports: import os
  import pytest
  import torch
  import ignite.distributed
  from ignite.exceptions import NotComputableError
  from ignite.metrics.gan.inception_score import InceptionScore
label_desc: Use image node_id 5 for calling a global function with example usage: _test_distrib_integration(device) and returns: y