code: def _test(self, comm, model, use_gpu, use_chx):
      if use_gpu:
          # Use CuPy's Device class to force call cudaSetDevice()
          chainer.cuda.get_device_from_id(comm.intra_rank).use()
  
      device = get_device(comm.intra_rank if use_gpu else None, use_chx)
      model.to_device(device)
  
      rank = comm.rank
      model.bn1.avg_mean.fill(rank * 1)
      model.bn2.avg_mean.fill(rank * 2)
      model.bn1.avg_var.fill(rank * 3)
      model.bn2.avg_var.fill(rank * 4)
  
      allreduce_persistent = chainermn.extensions.AllreducePersistent(
          model, comm
      )
      allreduce_persistent()
  
      avg_rank = (comm.size - 1) / 2.0
      chainer.testing.assert_allclose(model.bn1.avg_mean, avg_rank * 1)
      chainer.testing.assert_allclose(model.bn2.avg_mean, avg_rank * 2)
      chainer.testing.assert_allclose(model.bn1.avg_var, avg_rank * 3)
      chainer.testing.assert_allclose(model.bn2.avg_var, avg_rank * 4)
  
file_path: chainer/tests/chainermn_tests/extensions_tests/test_allreduce_persistent.py
imports: import chainer
  import chainer.testing
  import chainer.testing.attr
  import unittest
  import chainermn
  from chainermn.testing.device import get_device
label_desc: Use image node_id 1 for calling the TestAllreducePersistent obj's underlying member method code with example usage: obj._test(comm, model, use_gpu, use_chx) without return types