'Restore a checkpoint and decode it.
Args:
saver: Tensorflow checkpoint saver.
sess: Tensorflow session.
Returns:
If success, returns true, otherwise, false.'

def _Decode(self, saver, sess):

    ckpt_state = tf.train.get_checkpoint_state(FLAGS.log_root)
    if (not (ckpt_state and ckpt_state.model_checkpoint_path)):
        tf.logging.info('No    model    to    decode    yet    at    %s', FLAGS.log_root)
        return False
    tf.logging.info('checkpoint    path    %s', ckpt_state.model_checkpoint_path)
    ckpt_path = os.path.join(FLAGS.log_root, os.path.basename(ckpt_state.model_checkpoint_path))
    tf.logging.info('renamed    checkpoint    path    %s', ckpt_path)
    saver.restore(sess, ckpt_path)
    self._decode_io.ResetFiles()
    for _ in xrange(FLAGS.decode_batches_per_ckpt):
        (article_batch, _, _, article_lens, _, _, origin_articles, origin_abstracts) = self._batch_reader.NextBatch()
        for i in xrange(self._hps.batch_size):
            bs = beam_search.BeamSearch(self._model, self._hps.batch_size, self._vocab.WordToId(data.SENTENCE_START), self._vocab.WordToId(data.SENTENCE_END), self._hps.dec_timesteps)
            article_batch_cp = article_batch.copy()
            article_batch_cp[:] = article_batch[i:(i + 1)]
            article_lens_cp = article_lens.copy()
            article_lens_cp[:] = article_lens[i:(i + 1)]
            best_beam = bs.BeamSearch(sess, article_batch_cp, article_lens_cp)[0]
            decode_output = [int(t) for t in best_beam.tokens[1:]]
            self._DecodeBatch(origin_articles[i], origin_abstracts[i], decode_output)
    return True
