Issue
Hi I tried to predict a model with input shape of (3040,1) and when I tried to predict an array of shape (1,3040,1) it is returning and array of shape (1,3040,1) when I am expecting only one number between 1 and 0. I Tried changing shape to (3040,1) and (1,3040) and its producing output of shape (3040,1,1) but second one is returning a ValueError
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, 3040)
This is the model
model = Sequential()
model.add(Dense(units = 3040, input_shape = (3040,1), activation='relu'))
model.add(Dense(units = 2027, activation='relu'))
model.add(Dense(units = 1, activation = 'sigmoid'))
Please inform me if I did something wrong.
Solution
Working sample code
model = tf.keras.models.Sequential()
#model.add(tf.keras.Input(shape=(3040,)))
model.add(tf.keras.layers.Dense(3040, input_shape = (3040,1) , activation='relu'))
model.add(tf.keras.layers.Dense(2027, activation='relu'))
model.add(tf.keras.layers.Dense(1, activation = 'sigmoid'))
model.output_shape
Output
(None, 3040, 1)
Answered By - TFer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.