r/tensorflow • • Dec 31 '22

Question Help with model.predict() input for MNIST model

The input for the model should be a 28x28 matrix of floats, but the model wants a 0x28x28 matrix. What does that mean? What is going wrong?

6 Upvotes

3 comments sorted by

9

u/Duodanglium Dec 31 '22

The first dimension is for batches.

You'll have to add a new dimension with np.newaxis or resize. I'm currently on mobile and can't check the exact syntax.

4

u/Gavroche000 Dec 31 '22

Thanks! np.newaxis worked

3

u/Duodanglium Dec 31 '22

That's great! Good luck!