import tensorflow as tf


saver = tf.train.Saver(tf.global_variables())

with tf.Session() as sess:
    ckpt = tf.train.get_checkpoint_state('./model_pretrain')
    if ckpt and tf.train.checkpoint_exists(ckpt.model_checkpoint_path):
        print("loading checkpoint...")
        saver.restore(sess, ckpt.model_checkpoint_path)
