3ef43e41e74f4cebf8b1be006bf0b596a6b37e5a,python/caffe/pycaffe.py,,_Net_backward,#,73

Before Change


    self._backward()

    // Unpack diffs to extract
    outs = {out: self.blobs[out].diff for out in set(self.inputs + diffs)}
    return outs


def _Net_forward_all(self, blobs=None, **kwargs):

After Change



    if end is not None:
        end_ind = [lr.name for lr in self.layers].index(end)
        outputs = set([end] + diffs)
    else:
        end_ind = 0
        outputs = set(self.inputs + diffs)

    if kwargs:
        if set(kwargs.keys()) != set(self.outputs):
            raise Exception("Top diff arguments do not match net outputs.")
        // Set top diffs according to defined shapes and make arrays single and
        // C-contiguous as Caffe expects.
        for top, diff in kwargs.iteritems():
            if diff.shape[0] != self.blobs[top].num:
                raise Exception("Diff is not batch sized")
            if diff.ndim != 4:
                raise Exception("{} diff is not 4-d".format(top))
            self.blobs[top].diff[...] = diff

    self._backward(start_ind, end_ind)

    // Unpack diffs to extract
    return {out: self.blobs[out].diff for out in outputs}


def _Net_forward_all(self, blobs=None, **kwargs):
    
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: BVLC/caffe
Commit Name: 3ef43e41e74f4cebf8b1be006bf0b596a6b37e5a
Time: 2014-07-18
Author: jonlong@cs.berkeley.edu
File Name: python/caffe/pycaffe.py
Class Name:
Method Name: _Net_backward


Project Name: BVLC/caffe
Commit Name: 3ef43e41e74f4cebf8b1be006bf0b596a6b37e5a
Time: 2014-07-18
Author: jonlong@cs.berkeley.edu
File Name: python/caffe/pycaffe.py
Class Name:
Method Name: _Net_forward


Project Name: pysb/pysb
Commit Name: abf185095154a29c5cb4591512085f8e3c5920da
Time: 2013-06-12
Author: shawn@garbett.org
File Name: pysb/examples/run_tyson_oscillator.py
Class Name:
Method Name: find_slaves


Project Name: explosion/spaCy
Commit Name: 925a852bb6450e16a23346e97a1813fc0fcb22a0
Time: 2019-08-01
Author: adrianeboyd@gmail.com
File Name: spacy/scorer.py
Class Name: Scorer
Method Name: score