code: def testMultiThreadedEagerFunctionExecution(self):
      # Instrument for the main thread.
      instrument_0 = _NumpyFunctionCallback()
  
      # Instrument for the to-be-created thread.
      instrument_1 = _NumpyFunctionCallback()
  
      @def_function.function
      def square_log(x):
          return math_ops.square(math_ops.log(x))
  
      # Call the function once, so that the graph construction won't show up
      # in the callback.
      x_float32 = constant_op.constant(6.0, dtype=dtypes.float32)
      x_float64 = constant_op.constant(6.0, dtype=dtypes.float64)
      square_log(x_float32)
      square_log(x_float64)
  
      def thread_1_job():
          op_callbacks.add_op_callback(instrument_1.callback)
          square_log(x_float32)
  
      thread_1 = threading.Thread(target=thread_1_job)
      thread_1.start()
  
      # In the meantime, run some computation on the main thread.
      op_callbacks.add_op_callback(instrument_0.callback)
      square_log(x_float64)
  
      thread_1.join()
  
      # Each of the two dtypes should be associated with its own FuncGraph.
      self.assertIn(
          square_log.get_concrete_function(x_float64).name,
          instrument_0.eager_op_types,
      )
      self.assertEqual(instrument_0.eager_op_names, [None])
      self.assertFalse(instrument_0.graph_op_types)
      self.assertIn(
          square_log.get_concrete_function(x_float32).name,
          instrument_1.eager_op_types,
      )
      self.assertEqual(instrument_1.eager_op_names, [None])
      self.assertFalse(instrument_1.graph_op_types)
  
imports: import threading
  import numpy
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import test
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import op_callbacks
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import script_ops
  from tensorflow.python.ops import sparse_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.util import compat
label_desc: Use image node_id 7 for calling the OpCallbacksTest obj's underlying member method code with example usage: obj.testMultiThreadedEagerFunctionExecution() and returns: math_ops