8a70c277c355fe734a01fe58baafdc2dc5164205,OpenNMT/train.py,,eval,#Any#Any#Any#,122

Before Change


        loss = criterion.forward(outputs, tgt)

    model.train()
    return math.exp(loss / data.len)


def trainModel(model, trainData, validData, dataset):
    print(model)

After Change


    total_words = 0

    model.eval()
    for i in range(len(data)):
        batch = data[i]
        outputs = model(batch)
        loss = criterion(outputs, batch[1])
        total_loss += loss.data[0]
        total_words += batch[1].data.gt(onmt.Constants.EOS).sum()

    model.train()
    return total_loss / total_words

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: pytorch/examples
Commit Name: 8a70c277c355fe734a01fe58baafdc2dc5164205
Time: 2016-12-29
Author: alerer@fb.com
File Name: OpenNMT/train.py
Class Name:
Method Name: eval


Project Name: OpenNMT/OpenNMT-py
Commit Name: 8a70c277c355fe734a01fe58baafdc2dc5164205
Time: 2016-12-29
Author: alerer@fb.com
File Name: OpenNMT/train.py
Class Name:
Method Name: eval


Project Name: geomstats/geomstats
Commit Name: a9b58d07768ec06f8718ec2777f2b0293359f5b4
Time: 2020-04-09
Author: hadizaatiti@gmail.com
File Name: geomstats/learning/frechet_mean.py
Class Name:
Method Name: _ball_gradient_descent