我使用theano包来找到sigmoid函数的导数,使用交叉熵作为成本。这是我的代码:
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
但它在警告时给我一个错误,说它不被识别为变量。
答案 0 :(得分:1)
尝试
from theano import config
config.warn.sum_div_dimshuffle_bug = False
这对我有用