2023-05-16 10:04 AM
Sorry if this question is basic, but I was not able to find an answer in the documentation. I have a very simple Keras model with one input and one output, for your reference the architecture is:
model = tf.keras.Sequential()
model.add(tf.keras.layers.Dense(16, activation='relu', input_shape=(1,)))
model.add(tf.keras.layers.Dense(16, activation='relu'))
model.add(tf.keras.layers.Dense(1))
I have two vectors x_test and y_test with shape (200,), the same shape of my validation arrays used during the training phase, and I saved a .npz dataset to quantize the network as follows:
np.savez('testdata.npz',x_test=x_test,y_test=y_test)
I am using the STM32.AI developer cloud to quantize the network. Quantization fails, and the log displays the message:
Executing with: {'model': '...
Converting original model to TFLite...
cannot reshape array of size 200 into shape (1,1)
So apparently the problem is the shape of the data in the .npz file. Which shape should have the test vectors in the .npz file?
Best,
Pietro
Solved! Go to Solution.
2023-05-17 09:12 AM
Hello Pietro,
Your way to create the npz seems correct. We have perhaps an issue in the associated Cloud service to manage this simple case: input_shape=(1,), investigation is on-going on our side (including the documentation aspect). However, normaly if before to save the npz file, you reshape the input -> (200, 1), it should be correctly managed by the quantization service.
Best,
Jean-Michel
2023-05-17 09:12 AM
Hello Pietro,
Your way to create the npz seems correct. We have perhaps an issue in the associated Cloud service to manage this simple case: input_shape=(1,), investigation is on-going on our side (including the documentation aspect). However, normaly if before to save the npz file, you reshape the input -> (200, 1), it should be correctly managed by the quantization service.
Best,
Jean-Michel
2023-05-19 01:54 AM
Thank you. The reshaping workaround works.