An encoder transforms each input element into a context-dependent hidden representation, making sequential or graph-structured information easier for later model components to use. section 11.3.3 section 11.3.1
An encoder typically performs these roles:
- Processes an input sequence with a recurrent neural network, often using LSTM or GRU units. section 11.3.3
- Produces one hidden state for each input element, with each state incorporating context from the sequence. section 11.3.3
- Supplies representations to a decoder or attention mechanism that selects, generates, or classifies information. section 11.9
- Maps graph nodes into low-dimensional vectors using node position, neighborhood structure, features, or combinations of these. section 11.3.1
Encoding points for a convex hull
In a pointer network, an encoder processes a sequence of two-dimensional points and creates hidden states that summarize each point in context. A decoder and pointer attention then assign probabilities to input positions, selecting the next convex-hull point. A small implementation trains on random point sets with PyTorch, Adam, negative log-likelihood loss, and validation accuracy; a predicted hull can be compared with SciPy’s hull. section 11.9
Figure 11.19 Solving the convex hull problem using Ptr-Net. The output in each step is a pointer to the input that maximizes the probability distribution.
Follow the pointer-network diagram to see encoded sequence representations feeding attention, which points to the next input element. section 11.9
Figure 11.4 Graph embedding
Use the graph-embedding figure to contrast node encoders, which map graph structure and features into a latent vector space. section 11.3.1




















