In Keras, we create neural networks either using function API or sequential API. In both the APIs, it is very difficult to prepare data for the input layer to model, especially for RNN and LSTM models. This is because of the varying length of the input sequence. The variable lengths of the input sequence of data need to be converted to an equal length format. This task is achieved using masking and padding in Keras or TensorFlow. Masking and padding in Keras reshape the variable length input sequence to sequence of the same length.

Padding in Keras

To ensure that all the input sequence data is having the same length we pad or truncate the input data points. The deep learning model accepts the input data points of standardized tensors.

#keras tutorial #keras

Masking and Padding in Keras
5.95 GEEK