code: def test_checkpoint_is_sharded_by_task(self):
      servers = [
          server_lib.Server.create_local_server() for _ in range(3)
      ]
      cluster_spec = server_lib.ClusterSpec(
          {"worker": [s.target[len("grpc://") :] for s in servers]}
      )
      remote.connect_to_cluster(cluster_spec)
      with ops.device("/job:worker/task:0/cpu:0"):
          v0 = resource_variable_ops.ResourceVariable(0.0)
      with ops.device("/job:worker/task:1/cpu:0"):
          v1 = resource_variable_ops.ResourceVariable(1.0)
      with ops.device("/job:worker/task:2/cpu:0"):
          v2 = resource_variable_ops.ResourceVariable(2.0)
  
      self.evaluate([v0.initializer, v1.initializer, v2.initializer])
      saver = functional_saver.MultiDeviceSaver.from_saveables(
          list(saveable_object_util.saveable_objects_for_op(v0, "v0"))
          + list(saveable_object_util.saveable_objects_for_op(v1, "v1"))
          + list(saveable_object_util.saveable_objects_for_op(v2, "v2"))
      )
      prefix = os.path.join(self.get_temp_dir(), "ckpt")
      self.evaluate(saver.save(constant_op.constant(prefix)))
      self.assertEqual(4, len(gfile.Glob(prefix + "*")))
      self.evaluate(v0.assign(-1.0))
      self.evaluate(v1.assign(-1.0))
      self.evaluate(v2.assign(-1.0))
      self.evaluate(saver.restore(constant_op.constant(prefix)))
      self.assertEqual(0.0, self.evaluate(v0))
      self.assertEqual(1.0, self.evaluate(v1))
      self.assertEqual(2.0, self.evaluate(v2))
  
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 6 for calling the SaverTest obj's underlying member method code with example usage: obj.test_checkpoint_is_sharded_by_task() without return types