code: def test_amsgrad(self, backend_config):
      device = backend_config.device
  
      link = chainer.Link(x=(4,))
      x = link.x
      x.data.fill(0)
      link.to_device(device)
  
      opt = optimizers.Adam(alpha=0.01, beta2=0.7, amsgrad=True)
      opt.setup(link)
  
      x.grad = device.send(np.array([1, -1, 10, -10], np.float32))
      opt.update()
      testing.assert_allclose(
          x.update_rule.state["v"],
          [0.3, 0.3, 30, 30],
          atol=1e-7,
          rtol=1e-7,
      )
      testing.assert_allclose(
          x.data, [-0.01, 0.01, -0.01, 0.01], atol=1e-7, rtol=1e-7
      )
  
      x.grad = device.send(np.array([-10, -10, -1, -1], np.float32))
      opt.update()
      testing.assert_allclose(
          x.update_rule.state["v"],
          [30.21, 30.21, 21.3, 21.3],
          atol=1e-7,
          rtol=1e-7,
      )
      testing.assert_allclose(
          x.update_rule.state["vhat"],
          [30.21, 30.21, 30, 30],
          atol=1e-7,
          rtol=1e-7,
      )
      testing.assert_allclose(
          x.data,
          # result with NumPy
          [-0.00377703, 0.01745388, -0.01548985, 0.01686232],
          atol=1e-7,
          rtol=1e-7,
      )
  
imports: import pickle
  import unittest
  import numpy
  import six
  import chainer
  from chainer import functions
  from chainer import optimizers
  from chainer import testing
label_desc: Use image node_id 1 for calling the TestAMSGrad obj's underlying member method code with example usage: obj.test_amsgrad(backend_config) without return types