How to fix the input array to meet the input shape?
I tried to transpose the input array, as described here, but an error is the same.
ValueError: Error when checking input: expected dense_input to have shape (21,) but got array with shape (1,)
import tensorflow as tf
import numpy as npmodel = tf.keras.models.Sequential([tf.keras.layers.Dense(40, input_shape=(21,), activation=tf.nn.relu),tf.keras.layers.Dropout(0.2),tf.keras.layers.Dense(1, activation=tf.nn.softmax)
])
model.compile(optimizer='adam',loss='categorical_crossentropy',metrics=['accuracy'])arrTest1 = np.array([0.1,0.1,0.1,0.1,0.1,0.5,0.1,0.0,0.1,0.6,0.1,0.1,0.0,0.0,0.0,0.1,0.0,0.0,0.1,0.0,0.0])
scores = model.predict(arrTest1)
print(scores)