code: def test_optimizer(self, dev):
      o1 = opt.Optimizer(0.1)
  
      # test step
      o1.step()
      o1.step()
  
      # test get states
      s1 = o1.get_states()
      self.assertAlmostEqual(s1["step_counter"], 2)
  
      # test set states
      s2 = {"step_counter": 5}
      o1.set_states(s2)
      np.testing.assert_array_almost_equal(
          tensor.to_numpy(o1.step_counter), [5]
      )
  
imports: from __future__ import division
  import math
  import unittest
  import numpy
  import functools
  from singa import tensor
  from singa import singa_wrap
  from singa import opt
  from cuda_helper import gpu_dev, cpu_dev
label_desc: Use image node_id 1 for calling the TestOptimizer obj's underlying member method code with example usage: obj.test_optimizer(dev) without return types