class_docstr: A MapTransformFn that converts input blocks to batches.
class_docstr_tok: ["A","MapTransformFn","that","converts","input","blocks","to","batches","."]
code: def __init__(
      self,
      batch_size: Optional[int] = None,
      batch_format: str = "default",
      zero_copy_batch: bool = False,
  ):
      self._batch_size = batch_size
      self._batch_format = batch_format
      self._ensure_copy = not zero_copy_batch and batch_size is not None
      super().__init__(
          MapTransformFnDataType.Block,
          MapTransformFnDataType.Batch,
      )
  
imports: import itertools
  from abc import abstractmethod
  from enum import Enum
  from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union
  from ray.data._internal.block_batching.block_batching import batch_blocks
  from ray.data._internal.execution.interfaces.task_context import TaskContext
  from ray.data._internal.output_buffer import BlockOutputBuffer
  from ray.data.block import Block, BlockAccessor, DataBatch
label_desc: Use image node_id 1 to create a new BlocksToBatchesMapTransformFn object from inherited base classes: MapTransformFn with example: obj = BlocksToBatchesMapTransformFn(batch_size, batch_format, zero_copy_batch)