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


            for _ in range(len(data)):
                hidden, ls = parallel.get()
                // 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
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

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: scipy/scipy
Commit Name: ef7707947b85d141e955e844ec1800df9eddb5c2
Time: 2018-12-26
Author: ilhanpolat@gmail.com
File Name: scipy/linalg/blas.py
Class Name:
Method Name: find_best_blas_type


Project Name: biocore/scikit-bio
Commit Name: 8cb97248c6fe5b84312a3e4f74c20bfb19cc8d0e
Time: 2017-04-27
Author: sdbrown@gmail.com
File Name: skbio/tree/_nj.py
Class Name:
Method Name: _compute_collapsed_dm