code: def testReadDatasetOnDifferentDevices(self):
      cluster = data_service_test_base.TestCluster(num_workers=1)
      num_elements = 10
      with ops.device(self._devices[0]):
          dataset = dataset_ops.Dataset.range(num_elements)
          element_spec = dataset.element_spec
          dataset_id = data_service_ops.register_dataset(
              cluster.dispatcher_address(), dataset
          )
          dataset = data_service_ops.from_dataset_id(
              processing_mode=data_service_ops.ShardingPolicy.OFF,
              service=cluster.dispatcher_address(),
              dataset_id=dataset_id,
              element_spec=element_spec,
          )
          self.assertDatasetProduces(dataset, list(range(num_elements)))
  
      with ops.device(self._devices[1]):
          dataset = data_service_ops.from_dataset_id(
              processing_mode=data_service_ops.ShardingPolicy.OFF,
              service=cluster.dispatcher_address(),
              dataset_id=dataset_id,
              element_spec=dataset.element_spec,
          )
          self.assertDatasetProduces(dataset, list(range(num_elements)))
  
file_path: tensorflow-upstream/tensorflow/python/data/experimental/kernel_tests/service/multi_device_test.py
imports: from absl.testing import parameterized
  from tensorflow.python.data.experimental.kernel_tests.service import test_base
  from tensorflow.python.data.experimental.ops import data_service_ops
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import lookup_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the MultiDeviceTest obj's underlying member method code with example usage: obj.testReadDatasetOnDifferentDevices() without return types