(sess, graph, features)
return y_preds
:param sess:
    :param graph:
    :param features:
    :return:
def test_model(sess, graph, features):
    """

    :param sess:
    :param graph:
    :param features:
    :return:
    """

    total_loss = 0.0
    total_acc = 0.0

    input_ids = graph.get_operation_by_name('input_ids').outputs[0]
    input_mask = graph.get_operation_by_name('input_mask').outputs[0]
    segment_ids = graph.get_operation_by_name('segment_ids').outputs[0]
    is_training = graph.get_operation_by_name('is_training').outputs[0]
    loss = graph.get_operation_by_name('loss/loss').outputs[0]
    logits = graph.get_operation_by_name('loss/logits').outputs[0]

    data_len = len(features)
    batch_size = 24
    num_batch = int((len(features) - 1) / batch_size) + 1
    y_preds = []
    for i in range(num_batch):
        print(i)
        start_index = i * batch_size
        end_index = min((i + 1) * batch_size, data_len)
        batch_len = end_index - start_index
        _input_ids = np.array([data.input_ids for data in features[start_index:end_index]])
        _input_mask = np.array([data.input_mask for data in features[start_index:end_index]])
        _segment_ids = np.array([data.segment_ids for data in features[start_index:end_index]])
        feed_dict = {input_ids: _input_ids,
                     input_mask: _input_mask,
                     segment_ids: _segment_ids,
                     is_training: False}
        y_logits = sess.run(logits, feed_dict=feed_dict)
        y_batch_pred = get_logits_label(y_logits)
        y_preds.extend(y_batch_pred)
    return y_preds
def test_model ( sess , graph , features ) : total_loss = 0.0 total_acc = 0.0 input_ids = graph . get_operation_by_name ( 'input_ids' ) . outputs [ 0 ] input_mask = graph . get_operation_by_name ( 'input_mask' ) . outputs [ 0 ] segment_ids = graph . get_operation_by_name ( 'segment_ids' ) . outputs [ 0 ] is_training = graph . get_operation_by_name ( 'is_training' ) . outputs [ 0 ] loss = graph . get_operation_by_name ( 'loss/loss' ) . outputs [ 0 ] logits = graph . get_operation_by_name ( 'loss/logits' ) . outputs [ 0 ] data_len = len ( features ) batch_size = 24 num_batch = int ( ( len ( features ) - 1 ) / batch_size ) + 1 y_preds = [ ] for i in range ( num_batch ) : print ( i ) start_index = i * batch_size end_index = min ( ( i + 1 ) * batch_size , data_len ) batch_len = end_index - start_index _input_ids = np . array ( [ data . input_ids for data in features [ start_index : end_index ] ] ) _input_mask = np . array ( [ data . input_mask for data in features [ start_index : end_index ] ] ) _segment_ids = np . array ( [ data . segment_ids for data in features [ start_index : end_index ] ] ) feed_dict = { input_ids : _input_ids , input_mask : _input_mask , segment_ids : _segment_ids , is_training : False } y_logits = sess . run ( logits , feed_dict = feed_dict ) y_batch_pred = get_logits_label ( y_logits ) y_preds . extend ( y_batch_pred ) return y_preds