def evaluate(logger, hyperparams, enable_debug=False):
    config_proto = get_config_proto(hyperparams.device_log_device_placement, hyperparams.device_allow_soft_placement, hyperparams.device_allow_growth, hyperparams.device_per_process_gpu_memory_fraction)
    summary_output_dir = hyperparams.train_summary_output_dir
    if (not tf.gfile.Exists(summary_output_dir)):
        tf.gfile.MakeDirs(summary_output_dir)
    logger.log_print('##### create infer model #####')
    infer_model = create_infer_model(logger, hyperparams)
    infer_sess = tf.Session(config=config_proto, graph=infer_model.graph)
    if (enable_debug == True):
        infer_sess = tf_debug.LocalCLIDebugWrapperSession(infer_sess)
    infer_summary_writer = SummaryWriter(infer_model.graph, os.path.join(summary_output_dir, 'infer'))
    init_model(infer_sess, infer_model)
    eval_logger = EvalLogger(hyperparams.data_log_output_dir)
    logger.log_print('##### start evaluation #####')
    global_step = 0
    eval_mode = ('debug' if (enable_debug == True) else 'epoch')
    ckpt_file_list = infer_model.model.get_ckpt_list(eval_mode)
    for (i, ckpt_file) in enumerate(ckpt_file_list):
        sample_result = sample_predict(infer_sess, infer_model, hyperparams.train_eval_batch_size, ckpt_file, eval_mode)
        extrinsic_eval(eval_logger, infer_summary_writer, sample_result, hyperparams.train_eval_metric, hyperparams.train_eval_detail_type, global_step, i)
        decoding_eval(eval_logger, sample_result, hyperparams.train_decoding_sample_size, hyperparams.train_random_seed, global_step, i)
    infer_summary_writer.close_writer()
    logger.log_print('##### finish evaluation #####')
def evaluate(logger, hyperparams, enable_debug=False):
    config_proto = get_config_proto(hyperparams.device_log_device_placement, hyperparams.device_allow_soft_placement, hyperparams.device_allow_growth, hyperparams.device_per_process_gpu_memory_fraction)
    summary_output_dir = hyperparams.train_summary_output_dir
    if (not tf.gfile.Exists(summary_output_dir)):
        tf.gfile.MakeDirs(summary_output_dir)
    logger.log_print('##### create infer model #####')
    infer_model = create_infer_model(logger, hyperparams)
    infer_sess = tf.Session(config=config_proto, graph=infer_model.graph)
    if (enable_debug == True):
        infer_sess = tf_debug.LocalCLIDebugWrapperSession(infer_sess)
    infer_summary_writer = SummaryWriter(infer_model.graph, os.path.join(summary_output_dir, 'infer'))
    init_model(infer_sess, infer_model)
    eval_logger = EvalLogger(hyperparams.data_log_output_dir)
    logger.log_print('##### start evaluation #####')
    global_step = 0
    eval_mode = ('debug' if (enable_debug == True) else 'epoch')
    ckpt_file_list = infer_model.model.get_ckpt_list(eval_mode)
    for (i, ckpt_file) in enumerate(ckpt_file_list):
        sample_result = sample_predict(infer_sess, infer_model, hyperparams.train_eval_batch_size, ckpt_file, eval_mode)
        extrinsic_eval(eval_logger, infer_summary_writer, sample_result, hyperparams.train_eval_metric, hyperparams.train_eval_detail_type, global_step, i)
        decoding_eval(eval_logger, sample_result, hyperparams.train_decoding_sample_size, hyperparams.train_random_seed, global_step, i)
    infer_summary_writer.close_writer()
    logger.log_print('##### finish evaluation #####')