LSTM Output
Explore how to compute the outputs of LSTM models within TensorFlow using tf.keras.layers.RNN. Understand the management of variable sequence lengths with padding, and how to optimize model training by leveraging input length specifications and correct data types for efficient computation.
We'll cover the following...
Chapter Goals:
Compute the output of your LSTM model
A. TensorFlow implementation
In TensorFlow, the way we create and run an RNN is with the function tf.keras.layers.RNN. The function takes in two required arguments. The first is the cell object that is used to create the RNN (e.g. an LSTMCell, StackedRNNCells, etc.). The second is the batch of input sequences, which are usually first converted to word embedding sequences.
Of the keyword arguments for the function, it is required that either initial_state or dtype is set. The initial_state argument ...