Hello, I want to train a model to predict Spatio-temporal data. but before I train the model with LSTMs I want to use CNN to extract the patterns from my data, so to train my CNN parameter I’m dependent on the output of the LSTMs as the loss is calculated based on the output of the LSTM, I want to know is there a way to train both the parameters of the CNN and LSTM based on the output of the LSTM.
my intuition tells me to do something like this.
optimizer = optim.SGD([CNNmodel.parameters(),LSTMmodel.parameters()], lr=0.01, momentum=0.5)
I didn’t try it yet but does something like this work
You can understand better if you see the architecture of the model I’m trying to implement.
Hi
that should work as you suggested:
params = list(LSTM.parameters()) + list(CNN.parameters())
optimizer = optim.SGD(params, lr=learning_rate)