-
Notifications
You must be signed in to change notification settings - Fork 74k
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
InvalidArgumentError: Input to reshape is a tensor with 313600 values, but the requested shape requires a multiple of 4608 #6249
Comments
I'm sorry that nobody has answered on stackoverflow yet, but that is really the correct forum for this kind of usage question. Have you tried printing out the values of intermediate tensors e.g. h_conv1, h_conv2, h_pool, h_drop1? That should show you the shapes of all of them and help you understand where the tensor of size 313600 is coming from. |
Thanks. if I type |
The error was from a shape mismatch. After I changed conv2 to'VALID' from 'SAME', it worked. |
We answered this problem which is also related to architecture Understand this in following link |
In my case, |
where can I find conv2 ? |
Epoch 1/25InvalidArgumentError Traceback (most recent call last) 8 frames InvalidArgumentError: Input to reshape is a tensor with 3936256 values, but the requested shape requires a multiple of 6272 Function call stack: |
|
Hi the reason for this error is because of the shape of input check all of your input it may seem that all of them have the same shape but you may find some of them in wired shapes like 28283*3 as you see the third dimension is unusable. Solves when you use image flow define your shape as (28,28) some times you may define input shape to all of the layers recall that you should define it only for the first layer |
When I implemented this (https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py) by TensorFlow, I had an issue on reshaping. When I tried to flatten 12 * 12 * 32 tensor, I had an error message saying
tensorflow.python.framework.errors.InvalidArgumentError: Input to reshape is a tensor with 313600 values, but the requested shape requires a multiple of 4608 [[Node: Reshape_1 = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](dropout/mul, Reshape_1/shape)]]
I tried to match the input shape, but the error message said "a tensor with 313600 values" which I had no idea where this came from. Therefore, I thought this might be an issue on TensorFlow.
All the code and error message are uploaded here. http://stackoverflow.com/questions/40955223/tensorflow-python-framework-errors-invalidargumenterror-input-to-reshape-is-a-t
What related GitHub issues or StackOverflow threads have you found by searching the web for your problem?
http://stackoverflow.com/questions/38397258/error-tensorflow-cnn-dimension
#2048
Environment info
Operating System: macOS Sierra 10.12.1
Python 3.5.1
Installed version of CUDA and cuDNN:
(please attach the output of
ls -l /path/to/cuda/lib/libcud*
):No such file or directory
If installed from binary pip package, provide:
python -c "import tensorflow; print(tensorflow.__version__)"
.0.11.0rc1
If installed from source, provide
git rev-parse HEAD
)bazel version
If possible, provide a minimal reproducible example (We usually don't have time to read hundreds of lines of your code)
What other attempted solutions have you tried?
I tried the following solutions and I confirmed that I defined the target image for reshaping/flattening.
http://stackoverflow.com/questions/38397258/error-tensorflow-cnn-dimension
#2048
Logs or other output that would be helpful
(If logs are large, please upload as attachment or provide link).
I wrote all the code and errors here.
http://stackoverflow.com/questions/40955223/tensorflow-python-framework-errors-invalidargumenterror-input-to-reshape-is-a-t
The text was updated successfully, but these errors were encountered: