I am new to convLSTM2D and I understand how it works, however, I am confused about the shape of the hidden states at different epochs (h_t). Consider the following code:

input_shape=(11, 70,70,5)
model = tf.keras.Sequential()
model.add(ConvLSTM2D(7, (3, 3), activation='relu', padding='valid', return_sequences=True, data_format='channels_last'))

The output shape is as expected (None, 11,70,70,7) which tells me that the shape of h_t (or the cell state c_t) should be (70,70,7) at any epoch.

My question is: the convolution between h_t and the recurrent kernel (of shape (3,3,7)) must internally use padding='same', although I specified padding='valid' explicitly in the model.

Is it the case? Otherwise, if padding='valid' is used in the convolution between h_t and its corresponding kernel at any gate, the shape of h_t will gradually reduce with every epoch. Can you please confirm this?

The following sentence from this blog seems to confirm my thinking.

Note the convolution in h_{t-1} o recurrent_kernel is hardcoded to use 1x1 stride and padding = 'SAME' (TensorFlow code for recurrent_conv), therefore the output shape of convolution does not change.

However, it would be assuring to get a confirmation from here.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.