'''
Default options for backward compatibility
'''

#hacks for using old models with missing options (dict is modified in-place)
def fill_options(options):
    if not 'dropout_embedding' in options:
        options['dropout_embedding'] = 0
    if not 'dropout_hidden' in options:
        options['dropout_hidden'] = 0
    if not 'dropout_source' in options:
        options['dropout_source'] = 0
    if not 'dropout_target' in options:
        options['dropout_target'] = 0
    if not 'factors' in options:
        options['factors'] = 1
    if not 'dim_per_factor' in options:
        options['dim_per_factor'] = [options['dim_word']]
    if not 'model_version' in options:
        options['model_version'] = 0
    if not 'tie_encoder_decoder_embeddings' in options:
        options['tie_encoder_decoder_embeddings'] = False
    if not 'tie_decoder_embeddings' in options:
        options['tie_decoder_embeddings'] = False
@@ -896,28 +896,232 @@
 decoder_embeddings'%5D = False
+%0A    if not 'encoder_truncate_gradient' in options:%0A        options%5B'encoder_truncate_gradient'%5D = -1%0A    if not 'decoder_truncate_gradient' in options:%0A        options%5B'decoder_truncate_gradient'%5D = -1%0A%0A

set backward-compatible values for encoder_truncate_gradient