import torch


def evaluate(net, loaders):
    """
    Infer and check results against labels
    :param net: Model object in eval state
    :param loaders: List of torch dataloader for infer
    :return: List of [correct, total] for every dataloader, list of predicted results in int type
    """
    eval_result = list()
    ltotal = list()
    lcorrect = list()
    pred_result = list()
    for load in loaders:
        total = 0
        correct = 0
        pred_list = list()
        for data in load:
            inputs = data[0]
            labels = data[1]
            outputs = net(inputs)
            _, predicted = torch.max(outputs.data, 1)
            total += labels.size(0)
            correct += (predicted == labels).sum().item()
            pred_list += list(predicted.cpu().numpy())
        acc = correct/total
        eval_result.append(acc)
        lcorrect.append(correct)
        ltotal.append(total)
        pred_result.append(pred_list)
    return (lcorrect, ltotal), pred_result