Restores Tensorflow session from the latest checkpoint.
    :param session: The TF session
    :param checkpoint_dir: checkpoint files directory.
    :param saver: The saver object, if not provided a default saver object will be created.

def restore_session(session: tf.Session, checkpoint_dir: str,
                    saver: Optional[tf.train.Saver] = None) -> None:
    """
    Restores Tensorflow session from the latest checkpoint.
    :param session: The TF session
    :param checkpoint_dir: checkpoint files directory.
    :param saver: The saver object, if not provided a default saver object will be created.
    """
    checkpoint_path = tf.train.latest_checkpoint(checkpoint_dir)
    logger = settings.logger()
    if logger.isEnabledFor(logging.INFO):
        logger.info("Restoring session from `%s`.", checkpoint_path)

    saver = saver or get_default_saver()
    saver.restore(session, checkpoint_path)