I had build the hybrid CNN and LSTM model using Tensorflow 2.17 version. I want to add the backpropagating tuning to the LSTM to modify the weight of the LSTM layers. I try to find a way to access the weight to do calculation and update the weight during training for the LSTM . I had do some research where they build the LSTM manually instead apply tensorflow API. I just curious if there is a way that I could access the weight , then apply derivative and finally update while training.
Here is my model :
model_cnn = tf.keras.models.Sequential([
tf.keras.layers.Conv1D(input_shape = input_data_shape,
filters=256,
kernel_size=3,
activation='linear',
strides=1,
padding="causal"),
tf.keras.layers.MaxPooling1D(pool_size=2),
tf.keras.layers.Conv1D(filters=128,
kernel_size=3,
activation='linear',
strides=1,
padding="causal"),
tf.keras.layers.MaxPooling1D(pool_size=2),
tf.keras.layers.Dropout(0.5),
tf.keras.layers.LSTM(16 ,return_sequences=True),
tf.keras.layers.LSTM(8,return_sequences=True),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(1)
])
return model_cnn
My expectation is to access the weight and update the weight during training of the hybrid CNN and LSTM model.