1
我正在與theano和烤寬麪條。TypeError:不兼容的可廣播尺寸。預計(假),得到(真)
我想使用BatchNorm,我得到這個錯誤。有人能指導我,有什麼可能是錯的?或者,如果我可以得到具有這種不匹配的變量的名稱?
謝謝!
EDIT1:
我試圖做這樣的事情:
inputTarget = lasagne.layers.InputLayer(shape=(1,2,32, 32, 32), input_var=T.concatenate([tX, tY], axis=1))
network = lasagne.layers.SliceLayer(inputTarget, indices=slice(0, 1),axis=1)
tX_new = lasagne.layers.get_output(network)
network = lasagne.layers.batch_norm(network)
tY_predicted = lasagne.layers.get_output(network)
target= lasagne.layers.SliceLayer(inputTarget, indices=slice(1, None), axis=1)
tY_new = lasagne.layers.get_output(target)
loss = lasagne.objectives.squared_error(tY_predicted, tY_new).mean()
updates = lasagne.updates.adam(loss, params, learning_rate=lr)
train_fn = theano.function([tX, tY], [tY_predicted, loss, tY_new, tX_new], updates=updates)
日誌:
Traceback (most recent call last):
train_fn = theano.function([tX, tY], [tY_predicted, loss, tY_new, tX_new], updates=updates)
File "/lib/python2.7/site-packages/theano/compile/function.py", line 326, in function
output_keys=output_keys)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 449, in pfunc
no_default_updates=no_default_updates)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 219, in rebuild_collect_shared
cloned_v = clone_v_get_shared_updates(v, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
clone_v_get_shared_updates(i, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
clone_v_get_shared_updates(i, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 219, in rebuild_collect_shared
cloned_v = clone_v_get_shared_updates(v, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
clone_v_get_shared_updates(i, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
clone_v_get_shared_updates(i, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
clone_v_get_shared_updates(i, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
clone_v_get_shared_updates(i, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
clone_v_get_shared_updates(i, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
clone_v_get_shared_updates(i, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
clone_v_get_shared_updates(i, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
clone_v_get_shared_updates(i, copy_inputs_over)
File "/lib/python2.7/site-packages/theano/compile/pfunc.py", line 114, in clone_v_get_shared_updates
allow_convert=False)
File "/lib/python2.7/site-packages/theano/sandbox/cuda/type.py", line 185, in filter_variable
str(self.broadcastable)))
TypeError: Incompatible broadcastable dimensions. Expected (False,), got (True,).
檢查變量之後,我知道這些代碼減免平均值。我無法弄清楚爲什麼。
感謝您的回覆。我已經完成了這個頁面。檢查後,我可以看到代碼中斷的意思,但我不明白爲什麼。我真的很感激任何幫助。 – RJain
打破「意思」是什麼意思? – Sentient07
我的意思是當檢查執行「mean」時出現錯誤。 – RJain