class_docstr: Adds test methods running standard checkpointing tests.
docstr: Test a basic save/load cycle.
docstr_tok: ["Test","a","basic","save\/load","cycle","."]
code: def test_save_load(self, golden):
      """Test a basic save/load cycle."""
      module = golden.create_module()
      checkpoint = TestCheckpoint(module=module)
      all_variables = golden.create_all_variables(module)
  
      # Save zeros into the checkpoint.
      self.assertNotEmpty(all_variables)
      self.assertEqual(all_variables, module.variables)
      for variable in all_variables:
          # TODO(tomhennigan) Perhaps limit the range/switch to random to avoid
          # overflow/underflow in the forward pass?
          variable.assign(goldens.range_like(variable))
      checkpoint.save()
      old_y = golden.forward(module)
  
      # Overwrite zeros with ones.
      for variable in all_variables:
          variable.assign(tf.ones_like(variable))
  
      # Check restored values match the saved values.
      checkpoint.restore_latest(assert_consumed=True)
      for variable in all_variables:
          self.assertAllClose(
              variable.read_value(),
              goldens.range_like(variable),
              msg=variable.name,
          )
  
      # Test the output from the module remains stable.
      if golden.deterministic:
          tree.map_structure(
              self.assertAllClose, golden.forward(module), old_y
          )
  
imports: import os
  from absl import logging
  from absl.testing import absltest
  from absl.testing import parameterized
  from sonnet.src import test_utils
  from sonnet.src.conformance import goldens
  from sonnet.src.distribute import replicator
  from sonnet.src.distribute import replicator_test_utils
  import tensorflow
  import tree
label_desc: Use image node_id 1 for calling the GoldenCheckpointsTest obj's underlying member method code with example usage: obj.test_save_load(golden) without return types