Output shape of Conv1D

In C4_W4_Lab_1_LSTM.ipynb,
When build the model,

Reset states generated by Keras

tf.keras.backend.clear_session()

Build the model

model = tf.keras.models.Sequential([
tf.keras.layers.Conv1D(filters=64, kernel_size=3,
strides=1, padding=“causal”,
activation=“relu”,
input_shape=[window_size, 1]),
tf.keras.layers.LSTM(64, return_sequences=True),
tf.keras.layers.LSTM(64),
tf.keras.layers.Dense(1),
tf.keras.layers.Lambda(lambda x: x * 400)
])

Print the model summary

model.summary()

Why the output of conv1d (Conv1D) is (None, 20, 64) ?
How to understand the new_step calculation? Thanks so much!

Here’s the explanation:

  1. None: This refers to the batch size. Since this unknown till the time you invoke fit on the model, None serves as a placeholder.
  2. 20: Here’s the explanation for causal padding.
  3. 64: This is equal to the number of filters you use in the Conv1D layer

Thanks so much, Balaji!

My understanding is, with causal padding, the output shape will be same as input shape. So the new_step = original step, is this correct?

I don’t understand what step means. When stride = 1, the same number of outputs are generated as the input window width.

Conv1D
The input is (batch_size, steps, input_dim), the steps=window_size.
output shape is (batch_size, new_steps, filters)
new_steps=steps=window_size if padding is causal.

We both are saying the same thing. Thanks for clarifying.