41bd741fef07076d854bb164b5df764e9fcc6a2a,paysage/models/tap_machine.py,TAP_rbm,gradient,#TAP_rbm#Any#Any#,206

Before Change


        // compute average grad_F_marginal over the minibatch
        //score = 0.0
        dw = be.zeros_like(w)
        da = be.zeros_like(a)
        db = be.zeros_like(b)

        //TODO: vectorize
        for v in vdata:
            //score -= self.marginal_free_energy(v)
            dw += be.outer(v,be.expit(be.dot(v,w) + b))
            da += v
            db += be.expit(b + be.dot(v,w))

        grad = gu.Gradient(
            [None for l in self.layers],

After Change


        batch_size = be.shape(vdata)[0]
        // This is the same as \sum_{i} vdata[i] \outer intermediate[i]
        // TODO: is this efficient?
        dw = be.dot(be.transpose(vdata), intermediate) / batch_size

        grad = gu.Gradient(
            [None for l in self.layers],
            [None for w in self.weights]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: drckf/paysage
Commit Name: 41bd741fef07076d854bb164b5df764e9fcc6a2a
Time: 2017-04-17
Author: geminatea@gmail.com
File Name: paysage/models/tap_machine.py
Class Name: TAP_rbm
Method Name: gradient


Project Name: SeanNaren/deepspeech.pytorch
Commit Name: e30b50ff849a417b8e70d121edd2e85f0565eee1
Time: 2017-09-13
Author: jinserk.baik@gmail.com
File Name: data/data_loader.py
Class Name: NoiseInjection
Method Name: inject_noise_sample


Project Name: scikit-learn-contrib/polylearn
Commit Name: e8cfb65e94f53f34662a1d2c2bb25f7e80b6d3c7
Time: 2016-08-13
Author: vlad@vene.ro
File Name: polylearn/tests/test_cd_linear.py
Class Name:
Method Name: check_cd_linear_clf