'Perform unsupervised pretraining of the model.
:param layer_objs: list of model objects (autoencoders or rbms)
:param layer_graphs: list of model tf.Graph objects
:param set_params_func: function used to set the parameters after
pretraining
:param train_set: training set
:param validation_set: validation set
:return: return data encoded by the last layer'

def pretrain_procedure(self, layer_objs, layer_graphs, set_params_func, train_set, validation_set=None):

    next_train = train_set
    next_valid = validation_set
    for (l, layer_obj) in enumerate(layer_objs):
        print('Training    layer    {}...'.format((l + 1)))
        (next_train, next_valid) = self._pretrain_layer_and_gen_feed(layer_obj, set_params_func, next_train, next_valid, layer_graphs[l])
    return (next_train, next_valid)
