8d9e41ce407e88ec3404602d26bc7b019e31ffc2,OpenNMT/train.py,,eval,#Any#Any#Any#,111

Before Change



    model.evaluate()

    for i in range(data.batchCount()):
        batch = onmt.utils.Cuda.convert(data.getBatch(i))
        outputs = model.forward()
        loss = criterion.forward(outputs, batch.getTargetOutput())
        total = total + batch.targetNonZeros

    model.training()

    return math.exp(loss / total)

After Change



    model.evaluate()

    for src, tgt in data:
        outputs = model.forward(src)
        loss = criterion.forward(outputs, tgt)

    model.training()

    return math.exp(loss / data.len)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 8

Instances


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


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