code: def _scatter_index(n_total_samples, size, force_equal_length):
      assert size > 0
      assert n_total_samples >= 0
      if force_equal_length:
          n_sub_samples = (n_total_samples + size - 1) // size
          for i in range(size):
              b = n_total_samples * i // size
              e = b + n_sub_samples
              yield (i, b, e)
          return
      else:
          b = 0
          stride = (n_total_samples // size) + 1
          threshold = n_total_samples % size
          for i in range(threshold):
              e = b + stride
              yield (i, b, e)
              b += stride
          stride = n_total_samples // size
          for i in range(threshold, size):
              e = b + stride
              yield (i, b, e)
              b += stride
          return
  
file_path: chainer/chainermn/datasets/scatter.py
imports: import warnings
  import chainer.datasets
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: _scatter_index(n_total_samples, size, force_equal_length) without return types