ValueError: Negative dimension size caused by subtracting 3 from 1
See original GitHub issueFirst of all, great work with this project, Its been really helpful!
I’m a beginner at Python so I don’t know if there is something im doing wrong.
I’m running into a problem when trying to run the convolutional_neural_networks example in notebooks repository
When I try to run the following code:
model.add(Convolution2D(
n_filters, n_conv, n_conv,
border_mode='valid',
input_shape=(1, height, width)
))
I run into this error:
Traceback (most recent call last): File “/usr/local/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py”, line 594, in call_cpp_shape_fn status) File “/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py”, line 66, in exit next(self.gen) File “/usr/local/lib/python3.5/site-packages/tensorflow/python/framework/errors.py”, line 463, in raise_exception_on_not_ok_status pywrap_tensorflow.TF_GetCode(status)) tensorflow.python.framework.errors.InvalidArgumentError: Negative dimension size caused by subtracting 3 from 1
cheers, Alberto.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Just add this
yeah I checked the keras ‘mnist_cnn.py’ file and and I was able to go through this error by inverting the parameters in input_shape from (height, width, 1) instead of (1, height, width). But later on when running:
I get the following error :
Exception: Error when checking model input: expected convolution2d_input_2 to have shape (None, 28, 28, 1) but got array with shape (60000, 1, 28, 28)