Module batching

Source
Expand description

Uilities for dealing with batches, such as shuffling and sorting batches

Functionsยง

filter_by_length
Filters lists by a max length and returns the ones under the max
pad_batch
Pad all sequences to the length of the longest sequence
pad_mask
Create a pad mask based on the values in the batch (batch shape: batch size, seq len)
shuffle_lists
Shuffles multiple lists of the same length in the same ways
sort_lists_by_length
Sort lists by length. Uses the lengths of the elements in the first list passed in