Ask Your Question
1

How can I resolve the ValueError that says 'dense_input' should have three dimensions, but instead, the array with shape (1,1) was received?

asked 2021-07-09 11:00:00 +0000

lakamha gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-08-02 17:00:00 +0000

pufferfish gravatar image

You can resolve the ValueError by reshaping the input array to have three dimensions. You can do this by using the numpy reshape function.

For example, if your input array is called X and has shape (1,1), you can reshape it to have shape (1,1,1) using the following code:

import numpy as np
X = np.reshape(X, (1,1,1))

This will add a new dimension to the array, which should resolve the ValueError when you pass it to the model.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-07-09 11:00:00 +0000

Seen: 8 times

Last updated: Aug 02 '21