-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: The shape of the input to "Flatten" is not fully defined #25
Comments
Hi! I think it can be problem with keras 2.0, it is not tested, could you try with keras 1.2.2 ? |
Hello pplonski, I resolved that issue by changing to keras 1.2.2 but now another issue with Theano ifelse condition $ python example/mnist_cnn_one_iteration.py Using Theano backend. Thanks for your help. Bhushan |
Probably you have resolved this issue, just for the sake of completeness. You can modify the .../theano_backend.py according to this: |
Hello @pplonski,
Thank you for this tutorial to convert simple keras to cpp.
when I run the first command to generate ".h5 " and ".json" file I get following error:
I tried changing backends to both Theano and Tensorflow in keras.json file but still could not resolve this error.
$ python example/mnist_cnn_one_iteration.py
error:
Using Theano backend.
X_train shape: (60000, 1, 28, 28)
60000 train samples
10000 test samples
example/mnist_cnn_one_iteration.py:49: UserWarning: Update your
Conv2D
call to the Keras 2 API:Conv2D(4, (3, 3), padding="same", input_shape=(1, 28, 28...)
model.add(Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='same',input_shape=(1, img_rows, img_cols)))
example/mnist_cnn_one_iteration.py:51: UserWarning: Update your
Conv2D
call to the Keras 2 API:Conv2D(4, (3, 3), padding="same")
model.add(Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='same'))
Traceback (most recent call last):
File "example/mnist_cnn_one_iteration.py", line 56, in
model.add(Flatten())
File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 476, in add
output_tensor = layer(self.outputs[0])
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 615, in call
output_shape = self.compute_output_shape(input_shape)
File "/usr/local/lib/python2.7/dist-packages/keras/layers/core.py", line 481, in compute_output_shape
'(got ' + str(input_shape[1:]) + '. '
ValueError: The shape of the input to "Flatten" is not fully defined (got (0, 14, 4). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.
My keras.json file looks like:
{
"image_dim_ordering": "th",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "theano"
}
Please let me know about it.
Thank you.
Regards,
Bhushan
The text was updated successfully, but these errors were encountered: