Prefetch() usage

in C4 A2
it used prefetch() to prevent memory bottlenecks when reading from disk
can anyone please explain more the meaning and usage

Better performance with the tf.data API

Prefetching

Prefetching overlaps the preprocessing and model execution of a training step. While the model is executing training step s , the input pipeline is reading the data for step s+1 . Doing so reduces the step time to the maximum (as opposed to the sum) of the training and the time it takes to extract the data.

… the prefetch transformation provides benefits any time there is an opportunity to overlap the work of a “producer” with the work of a “consumer.”

1 Like