When building input pipelines with Tensorflow's Dataset
API, batch
ing comes up a lot. For example in: tf.data: Build TensorFlow input pipelines or Output differences when changing order of batch(), shuffle() and repeat().
What I've not been able to get a good answer on, though, is what problem batching in dataset generation solves in the first place or why I should use it. Can someone enlighten me?
I presume the dataset batches are an optimization to maximize throughput to a GPU, given limited memory, especially if the whole dataset doesn't fit into memory. Are there other scenarios?
I have a somewhat better idea of the purpose of the batch_size
parameter in the fit
function, from, e.g.
What is a batch in TensorFlow? However, what is the interaction or relationship between the dataset batches and the batch_size
specified in the fit
function for training.
How should either be chosen?