TensorFlow for RNN
The basic workflow for creating RNN models in low-level TensorFlow library is almost the same as MLP:
- First create the input and output placeholders of shape (None, # TimeSteps, # Features) or (Batch Size, # TimeSteps, # Features)
- From the input placeholder, create a list of length # TimeSteps, containing Tensors of Shape (None, #Features) or (Batch Size, # Features)
- Create a cell of the desired RNN type from the
tf.rnn.rnn_cell
module - Use the cell and the input tensor list created previously to create a static or dynamic RNN
- Create the output weights and bias variables, and define the loss and optimizer functions
- For the required number of epochs, train the model using the loss and optimizer functions
Let us look at the various classes available to support the previous workflow.
TensorFlow RNN Cell Classes
The tf.nn.rnn_cell
module contains the following classes for creating different kinds of cells in TensorFlow:
Class | Description |
BasicRNNCell | Provides simple RNN cell |
BasicLSTMCell... |