'Creates a dictionary storing the layer parameters and epochs complete.
Arguments:
fn (str): file to save pkl formatted model dictionary
keep_states (bool): Whether to save optimizer states.
Returns:
dict: Model data including layer parameters and epochs complete.'

def serialize(self, fn=None, keep_states=True):

    pdict = self.get_description(get_weights=True, keep_states=keep_states)
    pdict['epoch_index'] = (self.epoch_index + 1)
    if self.initialized:
        if (not hasattr(self.layers, 'decoder')):
            pdict['train_input_shape'] = self.layers.in_shape
        else:
            pdict['train_input_shape'] = (self.layers.encoder.in_shape + self.layers.decoder.in_shape)
    if (fn is not None):
        save_obj(pdict, fn)
        return
    return pdict
