24357bb63d8338158ddb7fefaf35ca4bd7064f31,train.py,,eval_epoch,#Any#Any#Any#Any#,78

Before Change


            loss, n_correct = get_performance(crit, pred, gold)

            // note keeping
            n_words = gold.data.ne(Constants.PAD).sum().item()
            n_total_words += n_words
            n_total_correct += n_correct
            total_loss += loss.item()

After Change


            total_loss += loss.item()

            msk_non_pad = gold.ne(Constants.PAD)
            n_word = msk_non_pad.sum().item()
            n_word_total += n_word
            n_word_correct += n_correct

    loss_per_word = total_loss/n_word_total
    accuracy = n_word_correct/n_word_total
    return loss_per_word, accuracy

def train(model, training_data, validation_data, crit, optimizer, device, opt):
    """ Start training """
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: jadore801120/attention-is-all-you-need-pytorch
Commit Name: 24357bb63d8338158ddb7fefaf35ca4bd7064f31
Time: 2018-08-22
Author: yhhuang@nlg.csie.ntu.edu.tw
File Name: train.py
Class Name:
Method Name: eval_epoch


Project Name: jadore801120/attention-is-all-you-need-pytorch
Commit Name: 24357bb63d8338158ddb7fefaf35ca4bd7064f31
Time: 2018-08-22
Author: yhhuang@nlg.csie.ntu.edu.tw
File Name: train.py
Class Name:
Method Name: train_epoch


Project Name: ecs-vlc/torchbearer
Commit Name: eca70286a076bcabd6a6690181a57f7da7ab30da
Time: 2019-01-24
Author: ewah1g13@soton.ac.uk
File Name: torchbearer/metrics/aggregators.py
Class Name: Mean
Method Name: process