code: def _get_tensors_by_task(self, root):
      serialized_tensors, _, _, _ = checkpoint.TrackableSaver(
          graph_view.ObjectGraphView(root)
      )._gather_serialized_tensors(None)
  
      tensors_by_task = {}
      for tensor_dict in serialized_tensors.values():
          for checkpoint_key, maybe_tensor in tensor_dict.items():
              if not isinstance(maybe_tensor, dict):
                  maybe_tensor = {"": maybe_tensor}
              for slice_spec, tensor in maybe_tensor.items():
                  tensor_task = saveable_object_util.set_cpu0(
                      tensor.device
                  )
                  (
                      tensors_by_task.setdefault(
                          tensor_task, {}
                      ).setdefault(checkpoint_key, {})[slice_spec]
                  ) = tensor
      return tensors_by_task
  
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 2 for calling the SaverTest obj's underlying member method code with example usage: obj._get_tensors_by_task(root) and returns: tensors_by_task