繁体   English   中英

如何将Theano标志warn.sum_div_dimshuffle_bug设置为False

[英]how to set the Theano flag warn.sum_div_dimshuffle_bug to False

我正在使用theano包,以交叉熵为代价来找到S型函数的导数。 这是我的代码:

 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)

运行代码时,出现以下错误:

 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.

但是我不知道该怎么做。 我尝试了这个:

 warn.sum_div_dimshuffle_bug= false

但是它在警告时给了我一个错误,说它不被识别为变量。

尝试

from theano import config
config.warn.sum_div_dimshuffle_bug = False

这对我有用

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM