The RNN cell implementation in Tensorflow can be found at here. The RNN model can be found here.
One great LSTM RNN tutorial is Colah’s Understanding LSTM Networks.
RNN Cell
The basic definition of RNN cell in Tensorflow is
1 | def __call(self, inputs): |
1 | def __call__(self, inputs, state, scope=None): |
And an instance looks like
1 | def __call__(self, inputs, state, scope=None): |
As we can see from the code, a RNN cell needs two inputs, inputs, and state, and then calculate the score and then return the result. Inside the cell, the calcuation is performed by tanh(linear([inputs, state], self._num_units, True)), therefore we need to check the definition of linear, which is
1 | def linear(args, output_size, bias, bias_start=0.0, scope=None): |