簡體   English   中英

值錯誤:Theano中的尺寸不匹配..

[英]Value Error: Dimension Mismatch .., in Theano

我只是遵循了卷積神經網絡教程,並嘗試從以下位置重寫代碼: http : //deeplearning.net/tutorial/code/convolutional_mlp.py

我嘗試從第108行更改代碼:

self.output = T.tanh(pooled_out + self.b.dimshuffle('x', 0, 'x', 'x'))

self.output = T.tanh(conv_out + self.b.dimshuffle('x', 0, 'x', 'x'))

然后我得到這個錯誤:

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_outconv_out在第二維上具有相同的形狀

有人可以幫我解釋為什么會這樣嗎?

問題不在LeNetConvPoolLayer內部, LeNetConvPoolLayer在下一層中,該層期望LeNetConvPoolLayer的輸出為一種尺寸,但會得到其他尺寸。

要跳過池化,您需要調整緊隨LeNetConvPoolLayer每一層,以期望其輸入具有適當的較大大小。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM