Negative dimension size caused by subtracting 3 from 1 for 'conv2d_2/convolution'
See original GitHub issueI got this error message when declaring the input layer in Keras.
ValueError: Negative dimension size caused by subtracting 3 from 1 for 'conv2d_2/convolution' (op: 'Conv2D') with input shapes: [?,1,28,28], [3,3,28,32].
My code is like this
model.add(Convolution2D(32, 3, 3, activation='relu', input_shape=(1,28,28)))
Sample application: https://github.com/IntellijSys/tensorflow/blob/master/Keras.ipynb
Please advice. Thank you.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:11
- Comments:10
Top Results From Across the Web
Negative dimension size caused by subtracting 3 from 1 for ...
Your issue comes from the image_ordering_dim in keras.json . From Keras Image Processing doc: dim_ordering: One of {"th", "tf"}.
Read more >Error: Negative dimension size caused by subtracting 3 from 1
Here's the error: Negative dimension size caused by subtracting 3 from 1 for 'conv2d_8/convolution' (op: 'Conv2D') with input shapes: [?,1,1 ...
Read more >Negative dimension size caused by subtracting 3 from 1 for ...
PYTHON : Negative dimension size caused by subtracting 3 from 1 for 'Conv2D' [ Gift : Animated Search Engine ...
Read more >ValueError: Negative dimension size caused by subtracting 3 ...
Binary classification problem: I want to have One input layer(optional), One Conv1D layer then output layer of 1 neuron predicting either 1 or...
Read more >Negative dimension size caused by subtracting 2 from 1 - Reddit
ValueError : Negative dimension size caused by subtracting 2 from 1 ... (3, 3), activation='relu')) model.add(MaxPooling2D(pool_size=(2, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@datomnurdin , that link fixed the same error I have. My line of code is (note the data_format arg):
model.add(Convolution2D(32, (3, 3), activation='relu', input_shape=(1,28,28), data_format='channels_first'))
I already fixed the problem, https://stackoverflow.com/questions/45645276/negative-dimension-size-caused-by-subtracting-3-from-1-for-conv2d-2-convolution/45647715#45647715.