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

Before Change


            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)
                    hiddens[j] = h

            autograd.backward(Ls)

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: 6

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: chainer/chainercv
Commit Name: 4a4e470321085513f38283c5aa2fd4460b80f58d
Time: 2017-03-15
Author: Hakuyume@users.noreply.github.com
File Name: chainercv/datasets/pascal_voc/voc_detection_dataset.py
Class Name: VOCDetectionDataset
Method Name: get_example


Project Name: keras-team/keras
Commit Name: 56e940e9634764e15a211e5642b3e9a838d075ff
Time: 2021-01-28
Author: scottzhu@google.com
File Name: keras/callbacks.py
Class Name: TensorBoard
Method Name: _push_writer