class_docstr: Chunks blocks into batches.
docstr: Construct a batcher that yields batches of batch_sizes rows.
  
  Args:
      batch_size: The size of batches to yield.
      ensure_copy: Whether batches are always copied from the underlying base
          blocks (not zero-copy views).
docstr_tok: ["Construct","a","batcher","that","yields","batches","of","batch_sizes","rows",".","Args",":","batch_size",":","The","size","of","batches","to","yield",".","ensure_copy",":","Whether","batches","are","always","copied","from","the","underlying","base","blocks","(","not","zero-copy","views",")","."]
code: def __init__(
      self, batch_size: Optional[int], ensure_copy: bool = False
  ):
      """
      Construct a batcher that yields batches of batch_sizes rows.
  
      Args:
          batch_size: The size of batches to yield.
          ensure_copy: Whether batches are always copied from the underlying base
              blocks (not zero-copy views).
      """
      self._batch_size = batch_size
      self._buffer = []
      self._buffer_size = 0
      self._done_adding = False
      self._ensure_copy = ensure_copy
  
imports: from typing import Optional
  from ray.data._internal.arrow_block import ArrowBlockAccessor
  from ray.data._internal.arrow_ops import transform_pyarrow
  from ray.data._internal.delegating_block_builder import DelegatingBlockBuilder
  from ray.data.block import Block, BlockAccessor
label_desc: Use image node_id 1 to create a new Batcher object from inherited base classes: BatcherInterface with example: obj = Batcher(batch_size, ensure_copy)