lynn
lynn

Reputation: 143

Tensorflow Dataset API: dataset.batch(n).prefetch(m) prefetches m batches or samples?

If I use

dataset.batch(n).prefetch(m), 

m batches or m samples will be prefetched?

Upvotes: 9

Views: 3535

Answers (1)

mrry
mrry

Reputation: 126154

The Dataset.prefetch(m) transformation prefetches m elements of its direct input. In this case, since its direct input is dataset.batch(n) and each element of that dataset is a batch (of n elements), it will prefetch m batches.

Upvotes: 20

Related Questions