我正在用 Theano 实现 DNN。在 DNN 的最后一层,我使用 softmax 作为非线性函数theano.tensor.nnet.softmax
作为一个丢失的函数,我正在使用交叉熵,T.nnet.binary_crossentropy
但我收到一个奇怪的错误:“编译节点时发生以下错误,GpuDnnSoftmaxGrad{tensor_format='bc01' ...”
我是 theano 的新手,无法弄清楚这个模型有什么问题。感谢您的帮助 PS:我的猜测是它与 softmax 采用 2D 张量并返回 2D 张量这一事实有某种关系。
PS2:我正在使用最先进的 Theano(刚刚克隆)我的 CUDA 版本是旧的,它是 4.2 但我几乎可以肯定这不是问题,因为我正在使用基于 Theano 编写的其他 DNN 工具没有错误。我正在使用 pylearn2 来加速,这也不是问题,因为我已经在另一个 DNN 中成功地将它与当前的 Theano 和 CUDA 一起使用。
错误发生在这一行:train= theano.function([idx], train_loss, givens=givens, updates=updates)
完整的错误信息是:
cmodule.py", line 293, in dlimport
rval = __import__(module_name, {}, {}, [module_name])
RuntimeError: ('The following error happened while compiling the node', GpuDnnSoftmaxGrad{tensor_format='bc01', mode='channel', algo='accurate'}(GpuContiguous.0, GpuContiguous.0), '\n', 'could not create cuDNN handle: The handle was not initialized(Is your driver recent enought?).', "[GpuDnnSoftmaxGrad{tensor_format='bc01', mode='channel', algo='accurate'}(<CudaNdarrayType(float32, (False, False, True, True))>, <CudaNdarrayType(float32, (False, False, True, True))>)]")
我使用的交叉熵函数定义为:
error = T.mean(T.nnet.binary_crossentropy(input, target_y)
其中输入是 softmax 层的输出,target_y 是标签。