docstr: Computes gradients w.r.t.\  specified inputs and accumulates them.
  
  This method provides a way to fuse the backward computation and the
  gradient accumulations in the case that the multiple functions are
  applied to the same variable.
  
  Users have to override either of this method or :meth:`backward`.
  It is often simpler to implement :meth:`backward` and is recommended
  if you do not need to provide efficient gradient accumulation.
  
  Args:
      target_input_indexes (tuple of int): Indices of the input variables
          w.r.t. which the gradients are required. It is guaranteed that
          this tuple contains at least one element.
      grad_outputs (tuple of Variable): Gradients w.r.t. the output
          variables. If the gradient w.r.t. an output variable is not
          given, the corresponding element is ``None``.
      grad_inputs (tuple of Variable): Gradients w.r.t. the input
          variables specified by ``target_input_indexes``. These values
          are computed by other computation paths. If there is no
          gradient value existing for the variable, the corresponding
          element is ``None``. See also the note below.
  
  Returns:
      Tuple of variables that represent the gradients w.r.t. specified
      input variables. Unlike :meth:`backward`, the length of the tuple
      **must** be same as that of ``target_input_indices``.
  
  .. note::
  
     When the same variable is passed to the multiple input arguments of
     a function, only the first position of ``grad_inputs`` corresponding
     to these input arguments may contain the gradient variable
     corresponding to that input variable, and other entries are set to
     ``None``. This is an implementation-detail convention to avoid the
     complication of correctly accumulating gradients in such a case.
     This behavior might be changed in a future version.
docstr_tok: ["Computes","gradients","w.r.t.\\","specified","inputs","and","accumulates","them",".","This","method","provides","a","way","to","fuse","the","backward","computation","and","the","gradient","accumulations","in","the","case","that","the","multiple","functions","are","applied","to","the","same","variable",".","Users","have","to","override","either","of","this","method","or",":","meth",":","`","backward","`",".","It","is","often","simpler","to","implement",":","meth",":","`","backward","`","and","is","recommended","if","you","do","not","need","to","provide","efficient","gradient","accumulation",".","Args",":","target_input_indexes","(","tuple","of","int",")",":","Indices","of","the","input","variables","w.r.t",".","which","the","gradients","are","required",".","It","is","guaranteed","that","this","tuple","contains","at","least","one","element",".","grad_outputs","(","tuple","of","Variable",")",":","Gradients","w.r.t",".","the","output","variables",".","If","the","gradient","w.r.t",".","an","output","variable","is","not","given",",","the","corresponding","element","is","``","None","``",".","grad_inputs","(","tuple","of","Variable",")",":","Gradients","w.r.t",".","the","input","variables","specified","by","``","target_input_indexes","``",".","These","values","are","computed","by","other","computation","paths",".","If","there","is","no","gradient","value","existing","for","the","variable",",","the","corresponding","element","is","``","None","``",".","See","also","the","note","below",".","Returns",":","Tuple","of","variables","that","represent","the","gradients","w.r.t",".","specified","input","variables",".","Unlike",":","meth",":","`","backward","`",",","the","length","of","the","tuple","*","*","must","*","*","be","same","as","that","of","``","target_input_indices","``",".","..","note",":",":","When","the","same","variable","is","passed","to","the","multiple","input","arguments","of","a","function",",","only","the","first","position","of","``","grad_inputs","``","corresponding","to","these","input","arguments","may","contain","the","gradient","variable","corresponding","to","that","input","variable",",","and","other","entries","are","set","to","``","None","``",".","This","is","an","implementation-detail","convention","to","avoid","the","complication","of","correctly","accumulating","gradients","in","such","a","case",".","This","behavior","might","be","changed","in","a","future","version","."]
code: def backward_accumulate(
      self, target_input_indexes, grad_outputs, grad_inputs
  ):
      """Computes gradients w.r.t.\\  specified inputs and accumulates them.
  
      This method provides a way to fuse the backward computation and the
      gradient accumulations in the case that the multiple functions are
      applied to the same variable.
  
      Users have to override either of this method or :meth:`backward`.
      It is often simpler to implement :meth:`backward` and is recommended
      if you do not need to provide efficient gradient accumulation.
  
      Args:
          target_input_indexes (tuple of int): Indices of the input variables
              w.r.t. which the gradients are required. It is guaranteed that
              this tuple contains at least one element.
          grad_outputs (tuple of Variable): Gradients w.r.t. the output
              variables. If the gradient w.r.t. an output variable is not
              given, the corresponding element is ``None``.
          grad_inputs (tuple of Variable): Gradients w.r.t. the input
              variables specified by ``target_input_indexes``. These values
              are computed by other computation paths. If there is no
              gradient value existing for the variable, the corresponding
              element is ``None``. See also the note below.
  
      Returns:
          Tuple of variables that represent the gradients w.r.t. specified
          input variables. Unlike :meth:`backward`, the length of the tuple
          **must** be same as that of ``target_input_indices``.
  
      .. note::
  
         When the same variable is passed to the multiple input arguments of
         a function, only the first position of ``grad_inputs`` corresponding
         to these input arguments may contain the gradient variable
         corresponding to that input variable, and other entries are set to
         ``None``. This is an implementation-detail convention to avoid the
         complication of correctly accumulating gradients in such a case.
         This behavior might be changed in a future version.
  
      """
      assert isinstance(target_input_indexes, tuple)
      assert isinstance(grad_outputs, tuple)
      assert isinstance(grad_inputs, tuple)
  
      # The default implementation uses backward(). You can override this
      # method without using backward().
      gxs = self._mock_backward(target_input_indexes, grad_outputs)
  
      len_gxs = len(gxs)
      if len_gxs == len(self.inputs):
          gxs = tuple([gxs[i] for i in target_input_indexes])
      elif len_gxs != len(target_input_indexes):
          raise ValueError(
              "number of gradients returned by %s (%s) is incorrect."
              % (self._impl_name, self.label)
          )
  
      return tuple(
          [
              gx
              if g_input is None
              else g_input
              if gx is None
              else gx + g_input
              for gx, g_input in six.moves.zip(gxs, grad_inputs)
          ]
      )
  
imports: import unittest
  import mock
  import numpy
  import six
  import chainer
  from chainer import _backprop_utils
  from chainer.backends import cuda
  from chainer import testing
  from chainer.testing import attr
label_desc: Use image node_id 1 for calling the FuncWithBackwardAccumulate obj's underlying member method code with example usage: obj.backward_accumulate(target_input_indexes, grad_outputs, grad_inputs) and returns: tuple