我刚刚学习了卷积神经网络教程,尝试重新编写代码: http://deeplearning.net/tutorial/code/convolutional_mlp.py
我试着把第108行的代码改为:
self.output = T.tanh(pooled_out + self.b.dimshuffle('x', 0, 'x', 'x'))
到
^{pr2}$然后我得到了一个错误:
ValueError: dimension mismatch in args to gemm (500,20000)x(800,500)->(500,500)
Apply node that caused the error: GpuDot22(GpuElemwise{tanh,no_inplace}.0, W)
Toposort index: 40
Inputs types: [CudaNdarrayType(float32, matrix), CudaNdarrayType(float32, matrix)]
Inputs shapes: [(500, 20000), (800, 500)]
Inputs strides: [(20000, 1), (500, 1)]
Inputs values: ['not shown', 'not shown']
Outputs clients: [[GpuElemwise{Composite{tanh((i0 + i1))}}[(0, 0)](GpuDot22.0, GpuDimShuffle{x,0}.0)]]
我不知道为什么会发生这种情况,因为我认为pooled_out
和{
有人能帮我解释一下为什么会这样吗?在
问题不在
LeNetConvPoolLayer
内部,而是在下一层中,该层希望LeNetConvPoolLayer
的输出为一个大小,但却得到了其他内容。在要跳过池,您需要调整
LeNetConvPoolLayer
后面的每个层,使其输入的大小适当增大。在相关问题 更多 >
编程相关推荐