问题
I am implementing the following architecture in Tensorflow 2.0 Dual Encoder LSTM
C and R are sentences encoded into a fixed dimension by the two LSTM's. Then they are passed through a function sigmoid(CMR). We can assume that R and C are both 256 dimensional matrices and M is a 256 * 256 matrix. The matrix M is learned during training. Since I want to train M, I declared M = tf.Variable(shape,trainable = True). But after fitting the model, the values of M are still not changing. How to tell tensorflow to compute the gradients for M automatically ? Below is my code. Code
来源:https://stackoverflow.com/questions/61434540/how-to-train-a-parameter-outside-the-model