'Loads model weights from a saved checkpoint.
Args:
checkpoint_dir: Directory which contains a saved checkpoint of the
model.'

def restore_vars_from_checkpoint(self, checkpoint_dir):

    tf.logging.info('Restoring    variables    from    checkpoint')
    var_dict = self.get_variable_name_dict()
    with self.graph.as_default():
        saver = tf.train.Saver(var_list=var_dict)
    tf.logging.info('Checkpoint    dir:    %s', checkpoint_dir)
    checkpoint_file = tf.train.latest_checkpoint(checkpoint_dir)
    if (checkpoint_file is None):
        tf.logging.warn("Can't    find    checkpoint    file,    using    %s", self.checkpoint_file)
        checkpoint_file = self.checkpoint_file
    tf.logging.info('Checkpoint    file:    %s', checkpoint_file)
    saver.restore(self.session, checkpoint_file)
