code: def concat_examples(
      batch,
      device=None,
      padding=None,
      indices_concat=None,
      indices_to_device=None,
  ):
      if len(batch) == 0:
          raise ValueError("batch is empty")
  
      first_elem = batch[0]
  
      elem_size = len(first_elem)
      if indices_concat is None:
          indices_concat = range(elem_size)
      if indices_to_device is None:
          indices_to_device = range(elem_size)
  
      result = []
      if not isinstance(padding, tuple):
          padding = [padding] * elem_size
  
      for i in six.moves.range(elem_size):
          res = [example[i] for example in batch]
          if i in indices_concat:
              res = _concat_arrays(res, padding[i])
          if i in indices_to_device:
              if i in indices_concat:
                  res = to_device(device, res)
              else:
                  res = [to_device(device, r) for r in res]
          result.append(res)
  
      return tuple(result)
  
imports: from __future__ import division
  import argparse
  import functools
  import multiprocessing
  import numpy
  import random
  import six
  import chainer
  from chainer.dataset.convert import _concat_arrays
  from chainer.dataset.convert import to_device
  import chainer.links
  from chainer.training import extensions
  from chainercv.chainer_experimental.datasets.sliceable import TransformDataset
  from chainercv.chainer_experimental.training.extensions import make_shift
  from chainercv.datasets import coco_bbox_label_names
  from chainercv.datasets import COCOBboxDataset
  from chainercv.links.model.light_head_rcnn import LightHeadRCNNResNet101
  from chainercv.links.model.light_head_rcnn import LightHeadRCNNTrainChain
  from chainercv.links.model.ssd import GradientScaling
  from chainercv import transforms
  import chainermn
label_desc: Use image node_id 1 for calling a global function with example usage: concat_examples(batch, device, padding, indices_concat, indices_to_device) and returns: tuple