code: def check_all_gather(xs, communicator):
      x = xs[communicator.rank]
      ys = chainermn.functions.allgather(communicator, x)
      e = 0
      for i, y in enumerate(ys):
          e += chainer.functions.mean_squared_error(y, xs[i])
      e.backward()
  
      # Check backward does not fall in deadlock, and error = 0.
      assert 0 == e.data
      assert None is not x.grad
  
imports: import chainer
  import chainer.testing
  import chainer.testing.attr
  import numpy
  import pytest
  import chainermn
  import chainermn.functions
label_desc: Use image node_id 2 for calling a global function with example usage: check_all_gather(xs, communicator) without return types