Closed amanrai closed 7 years ago
Hi @amanrai
You may get some help from the following answer on stackoverflow http://stackoverflow.com/questions/38656566/input-dimensions-to-a-one-dimensional-convolutional-network-in-keras
You might also have noticed that in the documentation of Convolution1D layer, it specifies the input shape as a 3D tensor with shape: (samples, steps, input_dim)
, so you might be getting it wrong there.
PS: I faced a similar kind of issue while working with the Convolution2D layer which showed the same exception: The first layer in a Sequential model must get an input_shape or batch_input_shape argument
on adding the Flatten layer. The problem in my case was with the Keras configuration file at ~/.keras/keras.json
which looks like this:
{
"image_dim_ordering": "tf",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}
I changed the backend
to "theano", but didn't change image_dim_ordering
to "th" for theano. As soon as I changed it, my code ran perfectly.
Hope I could be of some help. Cheers!
Hi,
I am attempting to merge several Convolution1D layers to perform a sentiment classification task.
Here is my full network:
When I run this code, I get the following error:
I checked several other issues here, but everyone suggests reading the documentation which states:
However, anytime I try to add an input_shape to the merged layer, I get another error.
This second error actually makes sense because the inputs to this layer should be coming from the convolutional layers being merged.
I'm unsure of how to proceed. Any help would be greatly appreciated.