i have function that creates a ann model
def create_model(input_dim, n_action):
""" A multi-layer perceptron """
model = tf.keras.Sequential()
model.add(tf.keras.layers.Conv1D(
128,
kernel_size=5,
padding='same',
activation=tf.keras.activations.relu,
input_shape=(101,)
))
model.add(tf.keras.layers.Conv1D(
64,
kernel_size=5,
padding='same',
activation=tf.keras.activations.relu,
))
model.add(tf.keras.layers.Dense(
64,
activation=tf.keras.activations.relu,
))
model.add(
tf.keras.layers.Dense(
64,
activation=tf.keras.activations.relu,
))
model.add(
tf.keras.layers.Dense(
32,
activation=tf.keras.activations.relu,
))
model.add(
tf.keras.layers.Dense(
n_action,
activation=tf.keras.activations.relu,
))
model.compile(loss='mse', optimizer='adam')
print((model.summary()))
return model
as you can see the first layer is a 1d convolutional layer with filters 128 and kelrnel size 5.
my dataset is just an array of numbers of length 101
[584.95 582.3 581.7 ... 392.35 391.8 391.3 ]
but when i do
model.train_on_batch(states, target_full)
where states are arrays of length 101 and batch size 32 i get this error.
Input 0 of layer "conv1d_118" is incompatible with the layer: expected min_ndim=3, found ndim=2. Full shape received: (None, 101)
I don't understand why dose a 1dconv need 3 dimensional input.Can anyone help me solve this error?
Any help is very much appreciated.