Are these lines of code equivalent in Keras? From a few runs, they seem to be, and also intuitively since the channels dimension of my data is 1, my understanding is that a fully connected acts like a convolutional layer. Is one better computationally (they have the same number of parameters)?
Conv1D(filters=1, kernel_size=1, strides=1, padding='causal') TimeDistributed(Dense(1))
For example, I have a regression problem, where I have (batches,64) points coming in and (batches,64) points coming out of the model.
My model is:
model = Sequential() model.add(Reshape([64, 1], input_shape=(64,))) model.add(BatchNormalization()) model.add(Conv1D(filters=4, kernel_size=8, strides=1, padding='causal', activation = 'relu')) model.add(BatchNormalization()) model.add(Conv1D(filters=1, kernel_size=1, strides=1, padding='causal')) model.add(Flatten()) model.compile(loss=loss, optimizer=optimizer)
My thinking for the layers is:
reshape dimensions to 3D. variance scale. conv layer, activation. variance scale. final layer: my question is whether is matters if its a TimeDistributed(Dense) or Conv in my situation. reshape back to a 2D waveform.
Thank you in advance!