char-rnn icon indicating copy to clipboard operation
char-rnn copied to clipboard

Question About train.lua

Open jxchen01 opened this issue 9 years ago • 1 comments

I really appreciate the nice implementation of RNN. I came across a question when I am trying to understand the training procedure.

In line the function feval(x), the variable "grad_params" are initialized as zeros. After that, the only operation is grad_params:clamp(). How is this variable updated during the training?

Thanks!

jxchen01 avatar Jan 13 '16 04:01 jxchen01

When :backward() is called on the network (e.g. those LSTM modules), grad_params is updated, since the gradient tensors in the modules point to some sub-array of grad_params. This was done by line 178:

params, grad_params = model_utils.combine_all_parameters(protos.rnn)

MTSranger avatar Apr 13 '16 14:04 MTSranger