user2816796
user2816796

Reputation: 1

Why tensorflow dataset neet to be batched before fit?

If we've made tensorflow dataset (for example from from_tensor_slices) we need to use .batch(...) method before we set this dataset as parameter of function fit(). Question is why method "fit" expect dataset to be batched ?

Upvotes: 0

Views: 100

Answers (1)

user11530462
user11530462

Reputation:

Datasets are sliced or batched for following reasons.

  1. To avoid high memory usage if entire Dataset is used as one batch ( which might create Out of Memory problems)

  2. Computation is faster when Training is done in Batches

  3. Weight and Bias update is possible with respect to labels when training is done is batches.

Reference: https://medium.com/@elimu.michael9/understanding-epochs-and-batches-23120a04b3cb

Upvotes: 1

Related Questions