liveBook · Manning

Dataset_batch

As explained in Deep Learning with R, Third Edition

dataset_batch is a dataset transformation method that groups individual elements into batches.

dataset_batch groups individual elements from a dataset into fixed-size batches, preparing data for efficient model processing. section 8.2.4

Batch sequential samples

dataset <- tensor_slices_dataset(example_array) batched_dataset <- dataset |> dataset_batch(3) Each yielded element now has shape (3, 6): three samples grouped together, rather than one sample with shape (6). section 8.2.4

How Deep Learning with R, Third Edition covers it

How deep it goes
Defines batching and demonstrates resulting tensor shapes, stopping short of detailed batching internals.
Examples
Uses a 100-by-6 integer array, batches it in groups of three, and inspects image batches shaped (32, 180, 180, 3).
What it assumes
Assumes familiarity with datasets and iterators while demonstrating element-wise datasets from an R array.
What you can do after
Apply it via tfdatasets to turn element-wise datasets into batches suitable for model training.
How it connects
Connects dataset batching with dataset iteration, dataset transformations, image datasets, and model fitting.

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.