need help with creating model in tensorflow [closed]
Here is the model I am using
model = tf.keras.Sequential([
tf.keras.layers.Flatten(input_shape=(1,)),
tf.keras.layers.Dense(128, activation='relu'),
tf.keras.layers.Dense(25,)
])
model.compile(loss="categorical_crossentropy", optimizer="adam", metrics="accuracy")
return model
my input layer is shaped like this
[0.46981431 0.32957182 0.6432879 ]
and my output layer is shaped like this
[[0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0.]
[0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1.
0.]]
The error I am having is
ValueError: Input 0 of layer sequential is incompatible with the layer: expected axis -1 of input shape to have value 1 but received input with shape (None, 25)
I don't understand what this means
I'm sorry, but this is not a ROS question. It's purely something about TensorFlow.
Please post your question on a more appropriate forum.
I know this is not the right place. @PGTKing Consider it as a hint.
Just to note: Your input data shape(3 shape which is "[0.46981431 0.32957182 0.6432879 ]") and your model shape do not match (Flatten with 1 shape). This both should be same.