code: def test_resource_variable_use_localhost(self):
      v1 = resource_variable_ops.ResourceVariable(2.0)
      self.evaluate(v1.initializer)
      saver = functional_saver.MultiDeviceSaver.from_saveables(
          saveable_object_util.saveable_objects_for_op(v1, "x")
      )
      prefix = os.path.join(self.get_temp_dir(), "ckpt")
      self.evaluate(
          saver.save(constant_op.constant(prefix), self.local_options)
      )
      self.assertEqual(2, len(gfile.Glob(prefix + "*")))
      self.evaluate(v1.assign(1.0))
      self.evaluate(saver.restore(prefix, self.local_options))
      self.assertEqual(2.0, self.evaluate(v1))
  
      v2 = resource_variable_ops.ResourceVariable(3.0)
      self.evaluate(v2.initializer)
      second_saver = functional_saver.MultiDeviceSaver.from_saveables(
          saveable_object_util.saveable_objects_for_op(v2, "x")
      )
      self.evaluate(second_saver.restore(prefix, self.local_options))
      self.assertEqual(2.0, self.evaluate(v2))
  
      # In graph mode, verify that the save and restore ops were set to run on
      # localhost.
      if not context.executing_eagerly():
          for op in ops.get_default_graph().get_operations():
              if op.type in ("SaveV2", "RestoreV2"):
                  self.assertEqual(LOCALHOST, op.device)
  
imports: import os
  import time
  from tensorflow.python.checkpoint import checkpoint
  from tensorflow.python.checkpoint import checkpoint_options
  from tensorflow.python.checkpoint import functional_saver
  from tensorflow.python.checkpoint import graph_view
  from tensorflow.python.eager import context
  from tensorflow.python.eager import remote
  from tensorflow.python.eager import test
  from tensorflow.python.eager import wrap_function
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.module import module
  from tensorflow.python.ops import gen_io_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.platform import gfile
  from tensorflow.python.training import server_lib
  from tensorflow.python.training.saving import saveable_object_util
label_desc: Use image node_id 4 for calling the SaverTest obj's underlying member method code with example usage: obj.test_resource_variable_use_localhost() without return types