Pads sequences to the same length
pad_sequences( sequences, maxlen = NULL, dtype = "int32", padding = "pre", truncating = "pre", value = 0 )
List of lists where each element is a sequence
int, maximum length of all sequences
type of the output sequences
'pre' or 'post', pad either before or after each sequence.
'pre' or 'post', remove values from sequences larger than maxlen either in the beginning or in the end of the sequence
float, padding value
Matrix with dimensions (number_of_sequences, maxlen)
This function transforms a list of
num_samples sequences (lists
of integers) into a matrix of shape
num_timesteps is either the
maxlen argument if provided, or the length
of the longest sequence otherwise.
Sequences that are shorter than
num_timesteps are padded with
Sequences longer than
num_timesteps are truncated so that they fit the
desired length. The position where padding or truncation happens is
determined by the arguments
Pre-padding is the default.