e85e31cfbd43e88184ed08cb977e2acaf5752d86,spacy/_ml.py,PrecomputableAffine,_backprop_padding,#PrecomputableAffine#Any#Any#,151

Before Change


    def _backprop_padding(self, dY, ids):
        // (1, nF, nO, nP) += (nN, nF, nO, nP) where IDs (nN, nF) < 0
        d_feats = dY[ids]
        ids = ids.reshape((ids.shape[0], ids.shape[1], 1, 1))
        d_feats *= ids < 0
        self.d_pad += d_feats.sum(axis=0, keepdims=True)
        return dY, ids

    @staticmethod
    def init_weights(model):

After Change



    def _backprop_padding(self, dY, ids):
        // (1, nF, nO, nP) += (nN, nF, nO, nP) where IDs (nN, nF) < 0
        for i in range(ids.shape[0]):
            for j in range(ids.shape[1]):
                if ids[i,j] < 0:
                    self.d_pad[0,j] += dY[i, j]
        return dY, ids

    @staticmethod
    def init_weights(model):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: explosion/spaCy
Commit Name: e85e31cfbd43e88184ed08cb977e2acaf5752d86
Time: 2017-11-01
Author: honnibal+gh@gmail.com
File Name: spacy/_ml.py
Class Name: PrecomputableAffine
Method Name: _backprop_padding


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/chainerrl
Commit Name: addee0cba18808235633faabd83b259a8bf8b2a8
Time: 2017-01-15
Author: muupan@gmail.com
File Name: tests/agents_tests/test_a3c.py
Class Name: TestA3C
Method Name: _test_abc