code: def testSaveRestoreNumpyState(self):
      directory = self.get_temp_dir()
      prefix = os.path.join(directory, "ckpt")
      save_state = _NumpyState()
      saver = util.Checkpoint(numpy=save_state)
      save_state.a = numpy.ones([2, 2])
      save_state.b = numpy.ones([2, 2])
      save_state.b = numpy.zeros([2, 2])
      save_state.c = numpy.int64(3)
      self.assertAllEqual(numpy.ones([2, 2]), save_state.a)
      self.assertAllEqual(numpy.zeros([2, 2]), save_state.b)
      self.assertEqual(3, save_state.c)
      first_save_path = saver.save(prefix)
      save_state.a[1, 1] = 2.0
      save_state.c = numpy.int64(4)
      second_save_path = saver.save(prefix)
  
      load_state = _NumpyState()
      loader = util.Checkpoint(numpy=load_state)
      loader.restore(first_save_path).initialize_or_restore()
      self.assertAllEqual(numpy.ones([2, 2]), load_state.a)
      self.assertAllEqual(numpy.zeros([2, 2]), load_state.b)
      self.assertEqual(3, load_state.c)
      load_state.a[0, 0] = 42.0
      self.assertAllEqual([[42.0, 1.0], [1.0, 1.0]], load_state.a)
      loader.restore(first_save_path).run_restore_ops()
      self.assertAllEqual(numpy.ones([2, 2]), load_state.a)
      loader.restore(second_save_path).run_restore_ops()
      self.assertAllEqual([[1.0, 1.0], [1.0, 2.0]], load_state.a)
      self.assertAllEqual(numpy.zeros([2, 2]), load_state.b)
      self.assertEqual(4, load_state.c)
  
imports: import io
  import os
  import numpy
  from tensorflow.python.checkpoint import checkpoint
  from tensorflow.python.client import session
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.module import module
  from tensorflow.python.platform import test
  from tensorflow.python.trackable import python_state
label_desc: Use image node_id 2 for calling the NumpyStateTests obj's underlying member method code with example usage: obj.testSaveRestoreNumpyState() without return types