I want to build a model with a number of Conv1d layers followed by several Linear layers. Since the data length is not needed for Conv1d layers, the Conv1d layers will work for data of any given length. Yet problem comes at Linear layer, because I don't know how to let the model to be experimented with different length of data. Now every time I change the length of input data, the output size of Conv1d layers will change, hence I have to manually reset the in_features of Linear layer.
Note: I learned CNN and I know clearly how to calculate the output dimensions by hand. I am looking for a programmatic way to determine it, because I have to experiment many times with different length of input data.
Question: In pytorch, how do you automatically figure out the output dimension after many Conv1d layers and set the in_features for the following Linear layer?