def evaluate_nli(nli_iterator, model, batch_size, n_gpus):
    """

    Args:
        nli_iterator(NLIIterator): NLIIterator object.
        model(MultitaskModel): Multitask model object.
        batch_size(int): Batch size.
        n_gpus(int): Number of gpus

    """
    n_correct = 0.0
    n_wrong = 0.0
    for j in range(0, len(nli_iterator.dev_lines), batch_size * n_gpus):
        minibatch = nli_iterator.get_parallel_minibatch(
            j, batch_size * n_gpus, "dev"
        )
        class_logits = model(
            minibatch, -1, return_hidden=False, paired_trg=None
        )
        class_preds = (
            f.softmax(class_logits).data.cpu().numpy().argmax(axis=-1)
        )
        labels = minibatch["labels"].data.cpu().numpy()
        for pred, label in zip(class_preds, labels):
            if pred == label:
                n_correct += 1.0
            else:
                n_wrong += 1.0
    logging.info("NLI Dev Acc : %.5f" % (n_correct / (n_correct + n_wrong)))
    n_correct = 0.0
    n_wrong = 0.0
    for j in range(0, len(nli_iterator.test_lines), batch_size * n_gpus):
        minibatch = nli_iterator.get_parallel_minibatch(
            j, batch_size * n_gpus, "test"
        )
        class_logits = model(
            minibatch, -1, return_hidden=False, paired_trg=None
        )
        class_preds = (
            f.softmax(class_logits).data.cpu().numpy().argmax(axis=-1)
        )
        labels = minibatch["labels"].data.cpu().numpy()
        for pred, label in zip(class_preds, labels):
            if pred == label:
                n_correct += 1.0
            else:
                n_wrong += 1.0
    logging.info("NLI Test Acc : %.5f" % (n_correct / (n_correct + n_wrong)))
    logging.info("******************************************************")


    Args:
        nli_iterator(NLIIterator): NLIIterator object.
        model(MultitaskModel): Multitask model object.
        batch_size(int): Batch size.
        n_gpus(int): Number of gpus

    
examples/sentence_similarity/gensen_train.py