import tensorflow as tf


    train_graph = tf.Graph()
    eval_graph = tf.Graph()
    infer_graph = tf.Graph()
    with train_graph.as_default():
        initializer = tf.random_uniform_initializer(-config.init_scale,
                                                    config.init_scale)

        with tf.name_scope('Train'):
            train_input = DataInput(config=config, data=train_data, name='TrainInput')
            with tf.variable_scope('Model', reuse=None, initializer=initializer):
                m = Model(is_training=True, config=config, input_=train_input, graph=train_graph)
            tf.summary.scalar('Training Loss', m.cost)
            tf.summary.scalar('Learning rate', m.lr)

    latest_ckpt = tf.train.latest_checkpoint(FLAGS.save_path)

    with train_graph.as_default():
        sv = tf.train.Supervisor(logdir=FLAGS.save_path)
        config_proto = tf.ConfigProto(log_device_placement=False,
                                      allow_soft_placement=True)
        with sv.managed_session(config=config_proto) as train_sess:
        #with tf.Session(config=config_proto) as train_sess:
            train_sess.run(tf.global_variables_initializer())
            for i in range(config.max_max_epoch):
                lr_decay = config.lr_decay ** max(i + 1 - config.max_epoch, 0.)
