code: def test_enqueue_cpu_tensor_with_outside_compilation(self, use_mlir):
      if use_mlir:
          config.enable_mlir_bridge()
  
      strategy, mid_level_api, _ = self._create_strategy_and_mid_level(
          "sgd"
      )
  
      dataset = self._create_dense_dataset(strategy)
      dense_iter = iter(
          strategy.experimental_distribute_dataset(dataset)
      )
  
      @def_function.function
      def test_fn():
          def get_activations(features):
              mid_level_api.enqueue(features, training=False)
              return mid_level_api.dequeue()
  
          activations = strategy.run(
              get_activations, args=(next(dense_iter),)
          )
          return activations
  
      with self.assertRaisesRegex(
          ValueError, "which is on a TPU input device"
      ):
          test_fn()
  
file_path: tensorflow-upstream/tensorflow/python/tpu/tests/tpu_embedding_v2_invalid_input_test.py
imports: from absl.testing import parameterized
  from tensorflow.python.compat import v2_compat
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import config
  from tensorflow.python.platform import test
  from tensorflow.python.tpu import tpu_embedding_v2
  from tensorflow.python.tpu import tpu_embedding_v2_utils
  from tensorflow.python.tpu.tests import tpu_embedding_base_test
label_desc: Use image node_id 7 for calling the TPUEmbeddingTest obj's underlying member method code with example usage: obj.test_enqueue_cpu_tensor_with_outside_compilation(use_mlir) and returns: activations, mid_level_api