class_docstr: Tests for batch_ops.{un,}batch.
class_docstr_tok: ["Tests","for","batch_ops",".","{","un",",","}","batch","."]
docstr: Tests that the batch_function op works.
docstr_tok: ["Tests","that","the","batch_function","op","works","."]
code: def testBatchFunctionOp(self):
      """Tests that the batch_function op works."""
      if context.executing_eagerly():
          return
      with self.cached_session() as sess:
  
          @function.Defun(dtypes.int32)
          def computation(in_t):
              return in_t + 1
  
          inp = array_ops.placeholder(dtype=dtypes.int32, shape=[1])
          result = gen_batch_ops.batch_function(
              [inp],
              num_batch_threads=1,
              max_batch_size=10,
              batch_timeout_micros=100000,
              Tout=[dtypes.int32],
              f=computation,
              captured_tensors=computation.captured_inputs,
          )
          thread_results = []
  
          def worker():
              thread_results.extend(
                  sess.run([result], feed_dict={inp: [1]})
              )
  
          worker_thread = threading.Thread(target=worker)
          worker_thread.start()
          main_results = sess.run([result], feed_dict={inp: [2]})
          worker_thread.join()
          self.assertEqual(thread_results[0], [2])
          self.assertEqual(main_results[0], [3])
  
imports: import threading
  import time
  import numpy
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import function
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.framework.errors import InvalidArgumentError
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import batch_ops
  from tensorflow.python.ops import gen_batch_ops
  from tensorflow.python.ops import gen_functional_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import script_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 12 for calling the BatchOpsTest obj's underlying member method code with example usage: obj.testBatchFunctionOp() and returns: unknown