Tutorial by Topics: generators



Generator functions (defined by the function* keyword) run as coroutines, generating a series of values as they're requested through an iterator.

Generators are lazy iterators created by generator functions (using yield) or generator expressions (using (an_expression for x in an_iterator)).

Machine learning problems often require dealing with large quantities of training data with limited computing resources, particularly memory. It is not always possible to load an entire training set into memory. Fortunately, this can be dealt with through the use of Keras' fit_generator method, Python generators, and HDF5 file format.


Page 1 of 1