31👍
✅
You’re asking the neural network to evaluate 784 cases with one input each instead of a single case with 784 inputs. I had the same problem and I solved it having an array with a single element which is an array of the inputs. See the example below, the first one works whereas the second one gives the same error you’re experiencing.
model.predict(np.array([[0.5, 0.0, 0.1, 0.0, 0.0, 0.4, 0.0, 0.0, 0.1, 0.0, 0.0]]))
model.predict(np.array([0.5, 0.0, 0.1, 0.0, 0.0, 0.4, 0.0, 0.0, 0.1, 0.0, 0.0]))
hope this solves it for you as well 🙂
Source:stackexchange.com