All models

PointerNetwork

Sequence model that points at input positions, so its output vocabulary grows with the input.

292 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (185 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
2.7K
Operations
292
Framework
PyTorch
Recurrent
Yes
Published
NeurIPS 2015
Cited by
133 (as of 17 October 2026)
Authors
Oriol Vinyals, Meire Fortunato, Navdeep Jaitly
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m2255
Graph hash
217ce079683d5ba33abfd2d0c75267f1f36a7a444a2391d636557645d9081a14
Skeleton hash
b0985183a0f00aade95854fe2319d5e875ac82cc3c4f0b1c33e4b5956868a77c
Architecture hash
8a23bd566447166f41a4cfa2a981f61e14176eec850709182f967ce0eec41b46
Diagram SHA-256
b5f1abe90bf7df0a6f39e2823bdfdbaf0af61e67e70c15d7d995f485716d67bc
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

Pointer Networks, or Ptr-Nets, are a neural architecture for learning the conditional probability of an output sequence whose elements are discrete tokens corresponding to positions in the input sequence. That covers problems such as sorting variable sized sequences and a range of combinatorial optimization problems, where the number of target classes at each output step depends on the length of the input. Ordinary sequence-to-sequence models and Neural Turing Machines cannot trivially address such problems.

The trick is a repurposed attention mechanism: instead of using attention to blend encoder hidden units into a context vector at each decoder step, Ptr-Net uses attention as a pointer that selects a member of the input sequence as the output. The output of that attention is a softmax distribution whose dictionary size equals the length of the input. Two separate RNNs do the work, one encoding the sequence of input vectors and another producing the output symbols. Those RNNs are Long Short Term Memory networks, as in the sequence-to-sequence baseline.

The paper applies Ptr-Nets to three geometric problems, finding planar convex hulls, computing Delaunay triangulations and the planar Travelling Salesman Problem, learning from training examples alone. The learnt models generalize beyond the maximum lengths they were trained on. On the convex hull task a single model trained on a range of lengths performs well on all of them. Even at 500 points the results are satisfactory, which the authors read as evidence that the model learned more than a simple lookup. The Pointer Net also learns a competitive small scale TSP approximate solver for up to 50 nodes. The captured member is a PyTorch reimplementation tested with Python 3.7.3 and PyTorch 1.1.0.

Key idea. Using attention as a pointer over the input sequence, so the output dictionary grows with the input length instead of being fixed in advance.

  • pointer networks
  • ptr-net
  • pointer net
  • vinyals
  • combinatorial optimization
  • convex hull
  • delaunay triangulation
  • travelling salesman problem
  • tsp
  • attention as pointer
  • seq2seq

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{vinyals2017pointernetworks,
      title={Pointer Networks}, 
      author={Oriol Vinyals and Meire Fortunato and Navdeep Jaitly},
      year={2017},
      eprint={1506.03134},
      archivePrefix={arXiv},
      primaryClass={stat.ML},
      url={https://arxiv.org/abs/1506.03134}, 
}