我正在使用 theano 和千层面。
我正在尝试使用 BatchNorm,但出现此错误。有人可以指导我,有什么问题吗?或者,如果我可以获得具有这种不匹配的变量的名称?
谢谢!
编辑1:
我正在尝试做这样的事情:
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,).
检查变量后,我知道代码中断了均值。我不知道为什么。