liveBook · Manning

Variable-length sequence

As explained in Inside Deep Learning: Math, Algorithms, Models

Input data whose number of elements can vary across examples and may require padding before batch processing.

A variable-length sequence contains a changing number of ordered items across examples. Unlike an image, it cannot be resized without potentially changing its meaning. Represent each item as a vector and use a sequence model that preserves order; T denotes the number of items. section 4.0

Typical representations and handling include:

  • Treat sentences as word or character sequences, hourly temperatures as time series, and videos as sequences of image vectors. section 4.0
  • Use recurrent neural networks when inputs have differing lengths and order matters. section 4.0
  • Use attention to process variable-length inputs, and apply masking when batching them. section 10.5

Different values of T

The sentences “the two previous sentences” contain 18 and 8 words, so their sequence lengths are T = 18 and T = 8. Sentiment detection can classify such word sequences. section 4.0

How Inside Deep Learning: Math, Algorithms, Models covers it

How deep it goes
Defines changing sequence length, introduces T notation, and notes batch masking without detailing padding or implementation steps.
Examples
Uses sentences, alphabets, hourly temperatures, videos, sentiment detection, and English-to-French translation as sequence examples.
What it assumes
Assumes that sequence items can be represented as vectors and that ordered inputs may contain different numbers of items.
What you can do after
Evaluate when recurrent or attention-based models can accommodate inputs with differing sequence lengths.
How it connects
Connects variable-length sequences to recurrent neural networks, attention mechanisms, masking, time series, and sequence classification.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Inside Deep Learning: Math, Algorithms, Models. The section links point to the parts of the book it draws on.