code: def testResourceOnWrongDevice(self):
      cluster = data_service_test_base.TestCluster(num_workers=1)
      with ops.device(self._devices[0]):
          initializer = self.lookupTableInitializer(
              "keyvaluetensor", [10, 11]
          )
          table = lookup_ops.StaticHashTable(initializer, -1)
          self.evaluate(lookup_ops.tables_initializer())
          dataset = dataset_ops.Dataset.range(3)
          dataset = dataset.map(table.lookup)
          dataset = self.make_distributed_dataset(dataset, cluster)
          self.assertDatasetProduces(
              dataset, [10, 11, -1], requires_initialization=True
          )
  
      with ops.device(self._devices[1]):
          dataset = dataset_ops.Dataset.range(3)
          dataset = dataset.map(table.lookup)
          with self.assertRaisesRegex(
              errors.FailedPreconditionError,
              "Serialization error while trying to register a dataset",
          ):
              dataset = self.make_distributed_dataset(dataset, cluster)
              self.getDatasetOutput(
                  dataset, requires_initialization=True
              )
  
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 3 for calling the MultiDeviceTest obj's underlying member method code with example usage: obj.testResourceOnWrongDevice() without return types