code: def test_registered_saver_is_called_before_save_after_load(self):
      if not context.executing_eagerly():
          self.skipTest("This test must run under eager mode.")
  
      class RestoreClass(autotrackable.AutoTrackable):
          pass
  
      def save_fn(trackables, file_prefix):
          del trackables  # Unused.
          # Check that directory is empty
          files = gfile.ListDirectory(
              os.path.dirname(file_prefix.numpy())
          )
          self.assertEmpty(files)
  
      def restore_fn(trackables, merged_prefix):
          del merged_prefix  # Unused.
          root = next(trackables.values())
          self.assertEqual(root.v.numpy(), 123)
  
      registration.register_checkpoint_saver(
          name="OptionalRestore",
          predicate=lambda x: isinstance(x, RestoreClass),
          save_fn=save_fn,
          restore_fn=restore_fn,
      )
  
      root = RestoreClass()
      root.v = variables.Variable(123.0)
  
      ckpt_path = os.path.join(self.get_temp_dir(), "ckpt")
      util.Checkpoint(root).write(ckpt_path)
  
imports: import os
  import tempfile
  from absl.testing import parameterized
  from google.protobuf import wrappers_pb2
  from tensorflow.python.checkpoint import checkpoint
  from tensorflow.python.client import session
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import test
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import io_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import gfile
  from tensorflow.python.saved_model import load
  from tensorflow.python.saved_model import loader
  from tensorflow.python.saved_model import registration
  from tensorflow.python.saved_model import save
  from tensorflow.python.trackable import autotrackable
label_desc: Use image node_id 6 for calling the SingleCycleTest obj's underlying member method code with example usage: obj.test_registered_saver_is_called_before_save_after_load() without return types