class_docstr: Custom Parallel Updater for chainer.
  
  Defines the main update routine.
  
  Args:
      train_iter (iterator | dict[str, iterator]): Dataset iterator for the
          training dataset. It can also be a dictionary that maps strings to
          iterators. If this is just an iterator, then the iterator is
          registered by the name ``'main'``.
      optimizer (optimizer | dict[str, optimizer]): Optimizer to update
          parameters. It can also be a dictionary that maps strings to
          optimizers. If this is just an optimizer, then the optimizer is
          registered by the name ``'main'``.
      converter (espnet.asr.chainer_backend.asr.CustomConverter): Converter
          function to build input arrays. Each batch extracted by the main
          iterator and the ``device`` option are passed to this function.
          :func:`chainer.dataset.concat_examples` is used by default.
      device (torch.device): Device to which the training data is sent.
          Negative value
          indicates the host memory (CPU).
      accum_grad (int):The number of gradient accumulation. if set to 2,
          the network parameters will be updated once in twice,
          i.e. actual batchsize will be doubled.
class_docstr_tok: ["Custom","Parallel","Updater","for","chainer",".","Defines","the","main","update","routine",".","Args",":","train_iter","(","iterator","|","dict","[","str",",","iterator","]",")",":","Dataset","iterator","for","the","training","dataset",".","It","can","also","be","a","dictionary","that","maps","strings","to","iterators",".","If","this","is","just","an","iterator",",","then","the","iterator","is","registered","by","the","name","``","'main","'","``",".","optimizer","(","optimizer","|","dict","[","str",",","optimizer","]",")",":","Optimizer","to","update","parameters",".","It","can","also","be","a","dictionary","that","maps","strings","to","optimizers",".","If","this","is","just","an","optimizer",",","then","the","optimizer","is","registered","by","the","name","``","'main","'","``",".","converter","(","espnet.asr.chainer_backend.asr.CustomConverter",")",":","Converter","function","to","build","input","arrays",".","Each","batch","extracted","by","the","main","iterator","and","the","``","device","``","option","are","passed","to","this","function",".",":","func",":","`","chainer.dataset.concat_examples","`","is","used","by","default",".","device","(","torch.device",")",":","Device","to","which","the","training","data","is","sent",".","Negative","value","indicates","the","host","memory","(","CPU",")",".","accum_grad","(","int",")",":","The","number","of","gradient","accumulation",".","if","set","to","2",",","the","network","parameters","will","be","updated","once","in","twice",",","i.e",".","actual","batchsize","will","be","doubled","."]
code: def __init__(
      self, train_iters, optimizer, converter, devices, accum_grad=1
  ):
      super(CustomParallelUpdater, self).__init__(
          train_iters, optimizer, converter=converter, devices=devices
      )
      from cupy.cuda import nccl
  
      self.accum_grad = accum_grad
      self.forward_count = 0
      self.nccl = nccl
  
imports: import collections
  import logging
  import math
  import numpy
  from chainer import Variable, cuda, training
  from chainer.training.updaters.multiprocess_parallel_updater import gather_grads, gather_params, scatter_grads
label_desc: Use image node_id 1 to create a new CustomParallelUpdater object from inherited base classes: training.updaters with example: obj = CustomParallelUpdater(train_iters, optimizer, converter, devices, accum_grad)