BBB
BBB

Reputation: 305

how to set the Theano flag warn.sum_div_dimshuffle_bug to False

I am using the theano package to find the derivative of a sigmoid function, using the cross entropy as the cost. This is my code:

 variable = tensor.dmatrix('variable')
 y= tensor.nnet.softmax(tensor.dot(z,variable))
 cost =tensor.sum( tensor.nnet.binary_crossentropy(y,y))
 gp = tensor.grad(cost,variable)
 dlogistic = function([variable],gp)

when I run my code, I get the following error:

 WARNING (theano.tensor.opt): WARNING: Your current code is fine,
 but Theano versions between rev. 3bd9b789f5e8 (2010-06-16) and 
 cfc6322e5ad4 (2010-08-03) would have given an incorrect result. 
 To disable this warning, set the Theano flag warn.sum_div_dimshuffle_bug
 to False.

But I dont know how to do that. I tried this:

 warn.sum_div_dimshuffle_bug= false

but it is giving me an error on warn, saying it is not recognized as a variable.

Upvotes: 0

Views: 1116

Answers (1)

John Salvatier
John Salvatier

Reputation: 3217

Try

from theano import config
config.warn.sum_div_dimshuffle_bug = False

This worked for me

Upvotes: 1

Related Questions