code: def check_gather(xs, communicator):
      root = 0
      # All processes receive the same xs since seed is fixed.
      x = xs[communicator.rank]
  
      if communicator.rank == root:
          ys = chainermn.functions.gather(communicator, x, root)
          e = 0
          for i, y in enumerate(ys):
              e += chainer.functions.mean_squared_error(y, xs[i])
          e.backward()
  
          # Check error = 0.
          assert 0 == e.data
  
      else:
          phi = chainermn.functions.gather(communicator, x, root)
          phi.backward()
  
      # Check backward does not fall in deadlock.
      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 11 for calling a global function with example usage: check_gather(xs, communicator) without return types