code: def _batch(
      tensors,
      batch_size,
      keep_input,
      num_threads=1,
      capacity=32,
      enqueue_many=False,
      shapes=None,
      dynamic_pad=False,
      allow_smaller_final_batch=False,
      shared_name=None,
      name=None,
  ):
      """Helper function for `batch` and `maybe_batch`."""
      if context.executing_eagerly():
          raise ValueError(
              "Input pipelines based on Queues are not supported when eager execution"
              " is enabled. Please use tf.data to ingest data into your model"
              " instead."
          )
      tensor_list = _as_tensor_list(tensors)
      with ops.name_scope(
          name, "batch", list(tensor_list) + [keep_input]
      ) as name:
          tensor_list = _validate(tensor_list)
          keep_input = _validate_keep_input(keep_input, enqueue_many)
          (tensor_list, sparse_info) = _store_sparse_tensors(
              tensor_list, enqueue_many, keep_input
          )
          types = _dtypes([tensor_list])
          shapes = _shapes([tensor_list], shapes, enqueue_many)
          # TODO(josh11b,mrry): Switch to BatchQueue once it is written.
          queue = _which_queue(dynamic_pad)(
              capacity=capacity,
              dtypes=types,
              shapes=shapes,
              shared_name=shared_name,
          )
          _enqueue(
              queue, tensor_list, num_threads, enqueue_many, keep_input
          )
          summary.scalar(
              "fraction_of_%d_full" % capacity,
              math_ops.cast(queue.size(), dtypes.float32)
              * (1.0 / capacity),
          )
  
          if allow_smaller_final_batch:
              dequeued = queue.dequeue_up_to(batch_size, name=name)
          else:
              dequeued = queue.dequeue_many(batch_size, name=name)
          dequeued = _restore_sparse_tensors(dequeued, sparse_info)
          return _as_original_type(tensors, dequeued)
  
imports: from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.layers import utils
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_assert
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import data_flow_ops
  from tensorflow.python.ops import io_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import sparse_ops
  from tensorflow.python.ops import variable_v1
  from tensorflow.python.summary import summary
  from tensorflow.python.training import queue_runner
  from tensorflow.python.util import deprecation
  from tensorflow.python.util.compat import collections_abc
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 24 for calling a global function with example usage: _batch(tensors, batch_size, keep_input, num_threads, capacity, enqueue_many, shapes, dynamic_pad, allow_smaller_final_batch, shared_name, name) and returns: _as_original_type