099e35f9db7e3098d8a88b99a9f5460b52bab2fc,tests/test_theano.py,,test_limb_darkened,#,60

Before Change


    // Compute the gradient using Theano
    varnames = sorted(theano_kwargs.keys())
    vars = [theano_kwargs[k] for k in varnames]
    computed = dict(zip(varnames, theano.function([], 
                                                  theano.grad(model[0], vars))()))

    // Compare
    for key in theano_kwargs.keys():
        if key == "zo":

After Change


    // Compute the gradient using Theano
    varnames = sorted(theano_kwargs.keys())
    vars = [theano_kwargs[k] for k in varnames]
    computed = {}
    for var in varnames:
        deriv = [theano.function([], 
                 theano.grad(model[i], theano_kwargs[var]))() 
                 for i in range(npts)]
        if var == "u":
            computed[var] = np.transpose(deriv)
        else:
            computed[var] = np.sum(deriv, axis=0)

    // Compare
    for key in theano_kwargs.keys():
        if key == "zo":
            continue
        assert np.allclose(np.squeeze(grad[key]), np.squeeze(computed[key]))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: rodluger/starry
Commit Name: 099e35f9db7e3098d8a88b99a9f5460b52bab2fc
Time: 2019-05-01
Author: rodluger@gmail.com
File Name: tests/test_theano.py
Class Name:
Method Name: test_limb_darkened


Project Name: tensorflow/cleverhans
Commit Name: 6667fb34f81f5c523c97952f1ea5fe0ba6d769bd
Time: 2017-06-21
Author: papernot@google.com
File Name: cleverhans/model.py
Class Name: KerasModelWrapper
Method Name: fprop


Project Name: CellProfiler/CellProfiler
Commit Name: 2bc6b146494b4971bb44fe1ea3ea57ddd6da69b3
Time: 2011-07-13
Author: leek@1fc53939-2000-0410-845c-e8453a809027
File Name: cellprofiler/gui/datatoolframe.py
Class Name: DataToolFrame
Method Name: on_image_choose


Project Name: pantsbuild/pants
Commit Name: bf9599809214cbc3082eb7f39c0ad3155822a2c5
Time: 2014-02-12
Author: benjy@foursquare.com
File Name: src/python/twitter/pants/tasks/jvm_compile/scala/zinc_analysis.py
Class Name: ZincAnalysis
Method Name: split