class_docstr: Adds test methods running standard checkpointing tests.
docstr: Tests that Variable values are restored on creation.
docstr_tok: ["Tests","that","Variable","values","are","restored","on","creation","."]
code: def test_restore_on_create(self, golden):
      """Tests that Variable values are restored on creation."""
      # Create a module, set its variables to sequential values and save.
      module_1 = golden.create_module()
      checkpoint_1 = TestCheckpoint(module=module_1)
      variables_1 = golden.create_all_variables(module_1)
      for variable in variables_1:
          variable.assign(goldens.range_like(variable))
      checkpoint_1.save()
      golden.forward(module_1)
  
      # Create a different module, restore from a checkpoint, create parameters
      # and assert their values are sequential.
      module_2 = golden.create_module()
      checkpoint_2 = TestCheckpoint(module=module_2)
      status = checkpoint_2.restore_latest(assert_consumed=False)
      variables_2 = golden.create_all_variables(module_2)
      status.assert_consumed()
      for var1, var2 in zip(variables_1, variables_2):
          self.assertAllEqual(
              var1.read_value(), var2.read_value(), msg=var1.name
          )
  
      # Assert the output from both modules is the same.
      if golden.deterministic:
          tree.map_structure(
              self.assertAllClose,
              golden.forward(module_1),
              golden.forward(module_2),
          )
  
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 3 for calling the GoldenCheckpointsTest obj's underlying member method code with example usage: obj.test_restore_on_create(golden) without return types