imnewhere
imnewhere

Reputation: 96

What exactly does prefetch in tensorflow?

After loaded a dataset, I'm resizing and normalizing a training_set.

myTrain = training_set.shuffle(train_ex//4).map(resizeIMG).batch(32).prefetch(1)

Is there anyone could kindly help me to understand the proper use of prefetch?

Upvotes: 2

Views: 2495

Answers (1)

basil mohamed
basil mohamed

Reputation: 47

Most dataset input pipelines should end with a call to prefetch. This allows later elements to be prepared while the current element is being processed. This often improves latency and throughput, at the cost of using additional memory to store prefetched elements.

Upvotes: 2

Related Questions