如何设置Theano标志warn.sum_div_dimshuffle_错误对福尔斯

2024-05-03 04:32:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用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)

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

^{pr2}$

但我不知道怎么做。我试过了:

 warn.sum_div_dimshuffle_bug= false

但是它在warn上给了我一个错误,说它没有被识别为变量。在


Tags: 函数代码错误theanovariable交叉warngp