(sess, graph, x_, y_)
return total_loss / data_len, total_acc / data_len
:param sess:
    :param graph:
    :param x_:
    :param y_:
    :return:
def test_model(sess, graph, x_, y_):
    """

    :param sess:
    :param graph:
    :param x_:
    :param y_:
    :return:
    """
    data_len = len(x_)
    batch_eval = batch_iter(x_, y_, 64)
    total_loss = 0.0
    total_acc = 0.0

    input_x = graph.get_operation_by_name('input_x').outputs[0]
    input_y = graph.get_operation_by_name('input_y').outputs[0]
    keep_prob = graph.get_operation_by_name('keep_prob').outputs[0]
    loss = graph.get_operation_by_name('optimize/loss').outputs[0]
    acc = graph.get_operation_by_name('accuracy/acc').outputs[0]

    for x_batch, y_batch in batch_eval:
        batch_len = len(x_batch)
        feed_dict = {input_x: x_batch, input_y: y_batch,
                     keep_prob: 1}
        test_loss, test_acc = sess.run([loss, acc], feed_dict=feed_dict)
        total_loss += test_loss * batch_len
        total_acc += test_acc * batch_len

    return total_loss / data_len, total_acc / data_len
def test_model ( sess , graph , x_ , y_ ) : data_len = len ( x_ ) batch_eval = batch_iter ( x_ , y_ , 64 ) total_loss = 0.0 total_acc = 0.0 input_x = graph . get_operation_by_name ( 'input_x' ) . outputs [ 0 ] input_y = graph . get_operation_by_name ( 'input_y' ) . outputs [ 0 ] keep_prob = graph . get_operation_by_name ( 'keep_prob' ) . outputs [ 0 ] loss = graph . get_operation_by_name ( 'optimize/loss' ) . outputs [ 0 ] acc = graph . get_operation_by_name ( 'accuracy/acc' ) . outputs [ 0 ] for x_batch , y_batch in batch_eval : batch_len = len ( x_batch ) feed_dict = { input_x : x_batch , input_y : y_batch , keep_prob : 1 } test_loss , test_acc = sess . run ( [ loss , acc ] , feed_dict = feed_dict ) total_loss += test_loss * batch_len total_acc += test_acc * batch_len return total_loss / data_len , total_acc / data_len