code: def test_enqueue_with_outside_compilation_non_direct_input(self):
      strategy, mid_level_api, _ = self._create_strategy_and_mid_level(
          "sgd"
      )
      mid_level_api.build(
          [
              TensorShape((self.batch_size, 2)),
              TensorShape((self.batch_size, 2)),
              TensorShape((self.batch_size, 3)),
          ]
      )
      dataset = self._create_sparse_dataset(strategy)
      dataset_iter = iter(
          strategy.experimental_distribute_dataset(
              dataset,
              options=distribute_lib.InputOptions(
                  experimental_fetch_to_device=False
              ),
          )
      )
  
      @def_function.function
      def enqueue_with_outside_compilation():
          def get_activations(features):
              # This inserts a mul operation on the TPU to trigger the direct input
              # error.
              features = (
                  features[0] * 2,
                  features[1] * 2,
                  features[2] * 2,
              )
              mid_level_api.enqueue(features, training=False)
              return mid_level_api.dequeue()
  
          return strategy.run(
              get_activations, args=(next(dataset_iter),)
          )
  
      with self.assertRaisesRegex(
          ValueError,
          "which does not have the `_tpu_input_identity` attr",
      ):
          enqueue_with_outside_compilation()
  
file_path: tensorflow-upstream/tensorflow/python/tpu/tests/tpu_embedding_v2_enqueue_mode_test.py
imports: from absl.testing import parameterized
  import numpy
  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.framework.tensor_shape import TensorShape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.platform import test
  from tensorflow.python.tpu.tests import tpu_embedding_base_test
  from tensorflow.python.util import nest
label_desc: Use image node_id 3 for calling the TPUEmbeddingTest obj's underlying member method code with example usage: obj.test_enqueue_with_outside_compilation_non_direct_input() and returns: strategy, mid_level_api