090944e816fd3ff8e861fba4452851e0a901491d,scripts/language_model/large_word_language_model.py,,train,#,193

Before Change


            Ls = []
            with autograd.record():
                for j, (X, y, m, s, h) in enumerate(zip(data, target, mask, sample, hiddens)):
                    output, h, new_target = model(X, y, h, s)
                    output = output.reshape((-3, -1))
                    new_target = new_target.reshape((-1,))
                    l = loss(output, new_target) * m.reshape((-1,))
                    Ls.append(l/args.batch_size)

After Change


                // hidden states are ordered by context id
                index = context.index(hidden[0].context)
                hiddens[index] = hidden
                Ls.append(ls)

            // prefetch the next batch of data
            try:
                data, target, mask, sample = next(train_data_iter)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: dmlc/gluon-nlp
Commit Name: 090944e816fd3ff8e861fba4452851e0a901491d
Time: 2019-01-28
Author: linhaibin.eric@gmail.com
File Name: scripts/language_model/large_word_language_model.py
Class Name:
Method Name: train


Project Name: tyarkoni/pliers
Commit Name: d6d3396a85f4dec27edf931985691ca53d218160
Time: 2016-10-28
Author: quinten.mcnamara@gmail.com
File Name: featurex/extractors/api.py
Class Name: IndicoAPIExtractor
Method Name: _extract


Project Name: Microsoft/nni
Commit Name: 73b2221b5eb4fd21802e6bf41e21d5df8ef9bf2c
Time: 2019-11-22
Author: v-yugzh@microsoft.com
File Name: src/sdk/pynni/nni/nas/pytorch/darts/trainer.py
Class Name: DartsTrainer
Method Name: _compute_hessian