Closed yxchng closed 8 years ago
I found out that it has to do with the average pooling layer. Apparently, "same" is only supported in Tensorflow. Do you not face the problem in Theano?
Which version of theano are you using? I dont seem to encounter the same issue
This is the error I get when I try to use the resnet implemented by you.
Traceback (most recent call last): File "resnet.py", line 297, in
main()
File "resnet.py", line 229, in main
history = model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=1, validation_data=(X_test, y_test), callbacks=[lrate, early_stop, hist, checkpoint])
File "/usr/local/lib/python2.7/site-packages/keras/engine/training.py", line 1082, in fit
callback_metrics=callback_metrics)
File "/usr/local/lib/python2.7/site-packages/keras/engine/training.py", line 801, in _fit_loop
outs = f(ins_batch)
File "/usr/local/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 531, in call
return self.function(*inputs)
File "/usr/local/lib/python2.7/site-packages/theano/compile/function_module.py", line 875, in call
storage_map=getattr(self.fn, 'storage_map', None))
File "/usr/local/lib/python2.7/site-packages/theano/gof/link.py", line 325, in raise_with_op
reraise(exc_type, exc_value, exc_trace)
File "/usr/local/lib/python2.7/site-packages/theano/compile/function_module.py", line 862, in call
self.fn() if output_subset is None else\
File "/usr/local/lib/python2.7/site-packages/theano/gof/op.py", line 908, in rval
r = p(n, [x[0] for x in i], o)
File "/usr/local/lib/python2.7/site-packages/theano/tensor/signal/pool.py", line 849, in perform
raise NotImplementedError()
NotImplementedError: Apply node that caused the error: AveragePoolGrad{ds=(7, 7), ignore_border=True, st=(1, 1), padding=(5, 5), mode='average_exc_pad'}(Elemwise{add,no_inplace}.0, IncSubtensor{InplaceInc;::, ::, :int64:, :int64:}.0) Toposort index: 1209 Inputs types: [TensorType(float32, 4D), TensorType(float32, 4D)] Inputs shapes: [(192, 8, 4, 4), (192, 8, 8, 8)] Inputs strides: [(512, 64, 16, 4), (2048, 256, 32, 4)] Inputs values: ['not shown', 'not shown'] Outputs clients: [[Sum{axis=[0, 2, 3], acc_dtype=float64}(AveragePoolGrad{ds=(7, 7), ignore_border=True, st=(1, 1), padding=(5, 5), mode='average_exc_pad'}.0), CorrMM_gradWeights{half, (1, 1)}(Elemwise{Composite{(i0 * (Abs(i1) + i2 + i3))}}[(0, 2)].0, AveragePoolGrad{ds=(7, 7), ignore_border=True, st=(1, 1), padding=(5, 5), mode='average_exc_pad'}.0, Subtensor{int64}.0, Subtensor{int64}.0), CorrMM_gradInputs{half, (1, 1)}(Subtensor{::, ::, ::int64, ::int64}.0, AveragePoolGrad{ds=(7, 7), ignore_border=True, st=(1, 1), padding=(5, 5), mode='average_exc_pad'}.0), Elemwise{add,no_inplace}(Elemwise{Composite{Switch(i0, i1, (i2 / i3))}}.0, Elemwise{Composite{((i0 * i1 * i2) / i3)}}.0, Elemwise{Composite{(((i0 / i1) / i2) / i3)}}.0, AveragePoolGrad{ds=(7, 7), ignore_border=True, st=(1, 1), padding=(5, 5), mode='average_exc_pad'}.0, Elemwise{Switch}[(0, 1)].0), Elemwise{add,no_inplace}(Elemwise{Composite{Switch(i0, i1, (i2 / i3))}}.0, Elemwise{Composite{((i0 * i1 * i2) / i3)}}.0, Elemwise{Composite{(((i0 / i1) / i2) / i3)}}.0, Elemwise{switch,no_inplace}.0, Elemwise{Composite{Switch(i0, i1, (i2 / i3))}}.0, Elemwise{Composite{((i0 * i1 * i2) / i3)}}.0, Elemwise{Composite{(((i0 / i1) / i2) / i3)}}.0, AveragePoolGrad{ds=(7, 7), ignore_border=True, st=(1, 1), padding=(5, 5), mode='average_exc_pad'}.0, Elemwise{Switch}[(0, 1)].0), Elemwise{Composite{(Switch(i0, i1, (i2 / i3)) + ((i4 * i5 * i6) / i7) + i8 + Switch(i0, i9, i1) + i10 + i11 + i12 + i13 + i14 + i15 + i16 + i17 + i18)}}[(0, 2)](InplaceDimShuffle{x,x,x,x}.0, TensorConstant{%281, 1, 1, 1%29 of 0}, Elemwise{mul}.0, Elemwise{add,no_inplace}.0, Elemwise{Composite{AND%28GE%28i0, i1%29, LE%28i0, i2%29%29}}.0, InplaceDimShuffle{x,0,x,x}.0, Elemwise{sub,no_inplace}.0, Elemwise{mul,no_inplace}.0, Elemwise{Composite{%28%28%28i0 / i1%29 / i2%29 / i3%29}}.0, Elemwise{true_div}.0, Elemwise{Composite{Switch%28i0, i1, %28i2 / i3%29%29}}.0, Elemwise{Composite{%28%28i0 i1 i2%29 / i3%29}}.0, Elemwise{Composite{%28%28%28i0 / i1%29 / i2%29 / i3%29}}.0, Elemwise{switch,no_inplace}.0, Elemwise{Composite{Switch%28i0, i1, %28i2 / i3%29%29}}.0, Elemwise{Composite{%28%28i0 i1 i2%29 / i3%29}}.0, Elemwise{Composite{%28%28%28i0 / i1%29 / i2%29 / i3%29}}.0, AveragePoolGrad{ds=%287, 7%29, ignore_border=True, st=%281, 1%29, padding=%285, 5%29, mode='average_exc_pad'}.0, Elemwise{Switch}[%280, 1%29].0)]]
Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer): File "/usr/local/lib/python2.7/site-packages/theano/gradient.py", line 1267, in access_grad_cache term = access_term_cache(node)[idx] File "/usr/local/lib/python2.7/site-packages/theano/gradient.py", line 961, in access_term_cache output_grads = [access_grad_cache(var) for var in node.outputs] File "/usr/local/lib/python2.7/site-packages/theano/gradient.py", line 1267, in access_grad_cache term = access_term_cache(node)[idx] File "/usr/local/lib/python2.7/site-packages/theano/gradient.py", line 961, in access_term_cache output_grads = [access_grad_cache(var) for var in node.outputs] File "/usr/local/lib/python2.7/site-packages/theano/gradient.py", line 1267, in access_grad_cache term = access_term_cache(node)[idx] File "/usr/local/lib/python2.7/site-packages/theano/gradient.py", line 961, in access_term_cache output_grads = [access_grad_cache(var) for var in node.outputs] File "/usr/local/lib/python2.7/site-packages/theano/gradient.py", line 1267, in access_grad_cache term = access_term_cache(node)[idx] File "/usr/local/lib/python2.7/site-packages/theano/gradient.py", line 1101, in access_term_cache input_grads = node.op.grad(inputs, new_output_grads)