code: def check_gradient_noise(self, backend_configs):
      target = self.target
      assert len(backend_configs) == len(list(target.params()))
      devices = [bc.device for bc in backend_configs]
      noise_value = np.asarray(self.noise_value)
      expects = []
      # Compute expected
      for param, device in zip(target.params(), devices):
          expects.append(param.array - param.grad - noise_value)
          param.to_device(device)
  
      def test_noise(xp, shape, dtype, hook, opt):
          # Make noise value an array of current backend
          return xp.array(noise_value)
  
      noise = mock.Mock(side_effect=test_noise)
      opt = optimizers.SGD(lr=1)
      opt.setup(self.target)
      hook = optimizer_hooks.GradientNoise(self.eta, noise_func=noise)
      opt.add_hook(hook)
      opt.update()
  
      # Validate
      for expect, param in zip(expects, target.params()):
          testing.assert_allclose(expect, param.array)
  
      self.assertEqual(
          noise.call_count, len(tuple(self.target.params()))
      )
  
      calls = []
      for param in target.params():
          xp = param.device.xp
          calls.append(
              mock.call(
                  xp,
                  (2, 3),
                  np.dtype("float32"),
                  hook,
                  param.update_rule,
              )
          )
  
      # Order does not matter
      assert any(
          [
              noise.mock_calls == list(permuted_calls)
              for permuted_calls in itertools.permutations(calls)
          ]
      )
  
file_path: chainer/tests/chainer_tests/optimizer_hooks_tests/test_gradient_noise.py
imports: import itertools
  import unittest
  import mock
  import numpy
  from chainer import optimizer_hooks
  from chainer import optimizers
  from chainer import testing
  import utils
label_desc: Use image node_id 2 for calling the TestGradientNoise obj's underlying member method code with example usage: obj.check_gradient_noise(backend_configs) and returns: xp