code: def _directional_backward_gradients(self, xs, ys, params, directions):
      no_gxs = self.no_gxs
  
      gys = [
          None if gy is None
          # Copy is needed to avoid being updated during backprop, which
          # would affect the numerical gradient.
          # TODO(niboshi): Preserve strides, for testing purpose.
          else chainer.Variable(gy.copy(), requires_grad=False)
          for gy in self.gys
      ]
  
      # Backward
      chainer.backward(ys, gys)
  
      for no_gx, x in six.moves.zip(no_gxs, xs):
          if no_gx and x.grad is not None:
              raise RuntimeError(
                  "gradient of int variable must be None"
              )
  
      grads = [
          None if x is None else x.grad
          for x, no_gx in six.moves.zip(xs, no_gxs)
          if not no_gx
      ] + [p.grad for p in params]
  
      gx_accum = 0
      assert len(grads) == len(directions)
      for g, direction in six.moves.zip(grads, directions):
          if g is not None:
              assert direction is not None
              gx_accum += (g.astype(numpy.float64) * direction).sum()
  
      return gx_accum
  
imports: from __future__ import absolute_import
  import warnings
  import numpy
  import six
  import chainer
  from chainer import backend
  from chainer.backends import _cpu
  from chainer.backends import cuda
  from chainer import configuration
  from chainer import testing
  from chainer import utils
  from chainer import variable
  import chainerx
label_desc: Use image node_id 10 for calling the _CheckBackward obj's underlying member method code with example usage: obj._directional_backward_gradients(xs, ys, params, directions) and returns: gx_accum