Why should we validate in batches?


In C2W2 Lab 2, as well as in the Programming Assignment, we validate the model in batches during training (see the perform_validation() function in both notebooks), but I do not recall any explanation as to why exactly are we doing it this way.

My understanding is that validating in batches is necessary when the entire validation data set would not fit into the memory. However, this is not the case in the above examples.

Is there any other advantage of doing validation in batches instead of evaluating the model on the entire validation set?



Normally validation is performed on batches as also training, because its also faster as well as less memory usage. If the lab is run in the coursera environment it also has additional constraint on memory available.