February 2019
Beginner to intermediate
308 pages
7h 42m
English
Before we can use the data as input to our neural network, we need to address an issue. Recall that in the previous section, we mentioned that movie reviews have different lengths, and therefore the input vectors have different sizes. This is an issue, as neural networks only accept fixed-size vectors.
To address this issue, we are going to define a maxlen parameter. The maxlen parameter shall be the maximum length of each movie review. Reviews that are longer than maxlen will be truncated, and reviews that are shorter than maxlen will be padded with zeros.
The following diagram illustrates the zero padding process:

Using zero ...
Read now
Unlock full access