HighwayJohn
HighwayJohn

Reputation: 921

Error for classifier.predict in tensorflow (Shape in shape_and_slice spec does not match)

I am new to tensorflow and to understand the basics I am following a tutorial. When copying this code (https://github.com/random-forests/tutorials/blob/master/ep7.ipynb) and trying to execute it I am getting an error.

W tensorflow/core/framework/op_kernel.cc:993] Invalid argument: Shape in shape_and_slice spec [1,10] does not match the shape stored in checkpoint: [784,10] Traceback (most recent call last):...

The command which seems to be responsible is the follwing:

 classifier.predict(test_data[0])

Can you tell me the problem?

Upvotes: 1

Views: 462

Answers (2)

Johnny R.
Johnny R.

Reputation: 126

Please try

classifier.predict(np.array([test_data[0]], dtype=float), as_iterable=False)

That worked for me

Upvotes: 7

GTO sama
GTO sama

Reputation: 1

side note : you have to increase the memory on the raspberry pi to be able to run the example ( and add plt.show() in the display function )

learned it from this site https://qiita.com/mgr206/items/9fc0de88ff9547372cac no need for japanese , just check the commands

Upvotes: 0

Related Questions