Autograd knowledge graph

Explore Autograd as a knowledge graph: 4,086 files, symbols and docs including ContainerVSpace, DictBox, DictMeta, DictVSpace — mapped with Lumvise.

What the graph contains

4,086 elements connected by 5,532 relationships.

  • 1,818 parameter
  • 1,696 function
  • 157 constant
  • 121 file
  • 95 field
  • 69 block
  • 52 class
  • 29 heading

Reports and notes

Reverse mode accumulates contributions along shared paths

Note

autograd/core.py

`backward_pass` starts with the seed gradient at the terminal node, traverses nodes in topological reverse order, applies each node's VJP, and accumulates contributions for every parent using `add_outgrads`. A value used more than once must receive all contributions. `make_vjp` returns both the primal result and a pullback function. If the result is independent of the input, the pullback returns zeros in the input's vector space. The same core handles scalar and array-shaped derivatives through `VSpace`. Evidence: [autograd/core.py](lumvise://element/filesystem%3A9fa464819bb8f798%3Aautograd%2Fcore.py%3Afile%3Acore.py%3A).

Tracing follows the operations actually executed

Note

autograd/tracer.py

`trace` creates a trace level, boxes the input with a root node, and calls the user's function. If the returned box belongs to the same trace, it returns the underlying result plus the final node. An output independent of the input produces a warning and no terminal node. This is an execution trace of supported primitives. Python branching and loops determine which operations run; Autograd does not differentiate the source text. Nested trace levels support differentiation of derivative computations. Evidence: [autograd/tracer.py](lumvise://element/filesystem%3A9fa464819bb8f798%3Aautograd%2Ftracer.py%3Afile%3Atracer.py%3A), [autograd/core.py](lumvise://element/filesystem%3A9fa464819bb8f798%3Aautograd%2Fcore.py%3Afile%3Acore.py%3A).

Primitive calls connect values to local derivative rules

Definition

autograd/tracer.py

The primitive wrapper finds boxed arguments at the highest active trace, unwraps their numerical values, evaluates the wrapped function, and creates a node linking the result to its parent nodes. Calls without boxed inputs run the raw function directly. A primitive becomes differentiable through registered VJP/JVP rules in `core.py`. Unsupported differentiation raises a missing-rule error rather than manufacturing a derivative. This boundary is where custom numerical operations integrate with the system. Evidence: [autograd/tracer.py](lumvise://element/filesystem%3A9fa464819bb8f798%3Aautograd%2Ftracer.py%3Afile%3Atracer.py%3A), [autograd/core.py](lumvise://element/filesystem%3A9fa464819bb8f798%3Aautograd%2Fcore.py%3Afile%3Acore.py%3A).

grad: differentiate a scalar-output function

Definition

autograd/differential_operators.py

`grad` builds a vector-Jacobian product, checks that the result has one real scalar output, then seeds that output with its vector-space representation of one. The returned derivative has the shape/type of the differentiated argument. The `unary_to_nary` decorator supplies the familiar argument-selection interface. For array-valued outputs, `jacobian` or `elementwise_grad` expresses a different question; the scalar restriction prevents silently treating a vector as a scalar loss. Higher derivatives compose the same differentiable machinery. Example: `grad(lambda x: x * x)(3.0)` has mathematical result `6.0`. This example explains the API; it was not executed during export. Evidence: [autograd/differential_operators.py](lumvise://element/filesystem%3A9fa464819bb8f798%3Aautograd%2Fdifferential_operators.py%3Afile%3Adifferential_operators.py%3A).

Functional meaning: __init__.py

Summary

examples/__init__.py

## Job Marks the examples directory as a Python package via an empty __init__.py ## Source Interface empty module (no definitions, imports, or statements) ## Receives - None declared by immediate child artifacts. ## Outcome Package marker only; the file contains no executable code ## Notable Effects - None declared by immediate child artifacts.

Start here: autograd knowledge graph

Guide

README.md

# autograd source tour This demo combines the complete published semantic index with selected explanations attached to real files, folders, classes, and functions. Start with architecture, then follow the core concepts: 1. [Autograd architecture: tracing plus derivative rules](lumvise://artifact/popular-demo-20260928%3Aautograd%3Aarchitecture) 2. [grad: differentiate a scalar-output function](lumvise://artifact/popular-demo-20260928%3Aautograd%3Agrad) 3. [Tracing follows the operations actually executed](lumvise://artifact/popular-demo-20260928%3Aautograd%3Atrace) 4. [Primitive calls connect values to local derivative rules](lumvise://artifact/popular-demo-20260928%3Aautograd%3Aprimitive) 5. [Reverse mode accumulates contributions along shared paths](lumvise://artifact/popular-demo-20260928%3Aautograd%3Areverse) 6. [How Autograd checks its derivatives](lumvise://artifact/popular-demo-20260928%3Aautograd%3Atests) 7. [Source snapshot, index coverage, and validation scope](lumvise://artifact/popular-demo-20260928%3Aautograd%3Aprovenance) Select an artifact to inspect its owning semantic element. Evidence links point to indexed source. The source snapshot and coverage report records the exact scope and parser limitations.

Autograd architecture: tracing plus derivative rules

Report

autograd

# Autograd architecture Autograd differentiates Python functions built from supported operations. The public operators in `differential_operators.py` adapt ordinary function arguments and request vector-Jacobian or Jacobian-vector products from `core.py`. `tracer.py` records executed primitive calls using boxed values; the derivative registries in the core supply the local rules. ```text user function → grad / jacobian ↓ make_vjp → trace → primitive nodes ↓ backward_pass → input derivatives ``` NumPy wrappers and derivative definitions extend this mechanism to arrays. `VSpace` describes zeros, addition, and inner products for each supported value type. Forward mode uses JVP nodes; reverse mode uses VJP nodes. Keeping tracing separate from derivative rules makes the same executed Python control flow usable by both modes. Explore `grad`, `primitive`, and `backward_pass` to follow the main chain. Evidence: [autograd/core.py](lumvise://element/filesystem%3A9fa464819bb8f798%3Aautograd%2Fcore.py%3Afile%3Acore.py%3A), [autograd/tracer.py](lumvise://element/filesystem%3A9fa464819bb8f798%3Aautograd%2Ftracer.py%3Afile%3Atracer.py%3A), [autograd/differential_operators.py](lumvise://element/filesystem%3A9fa464819bb8f798%3Aautograd%2Fdifferential_operators.py%3Afile%3Adifferential_operators.py%3A).

Source snapshot, index coverage, and validation scope

Report

README.md

# Export provenance Upstream: [HIPS/autograd](https://github.com/HIPS/autograd). This graph was generated on 2026-09-28 from the existing local source folder. The folder has no Git metadata, so an exact upstream commit is unknown; no branch or commit is guessed. It was not updated from upstream during export. Source snapshot fingerprint: `88c3a289c49faec4fda5180d7e10a7d823332306a46680972e44d6a95f9816a8` (SHA-256 over sorted relative paths, NUL separators, and raw file SHA-256 digests; excludes Git/runtime/generated cache directories and symlinks). Regular source files: 136. Indexed semantic elements: 4086. File/text parser records: 121 (10 plain_text, 111 parsed); images have separate semantic kinds. No syntax or conversion warnings were reported for indexed text files. Static extraction is best effort. Unresolved dynamic calls are not evidence that dependencies are absent. Knowledge explanations were checked against selected local source; upstream test suites, notebooks, model inference, and model downloads were not run. The task validates index/export contents and readability.

Documentation topics

  • Contributing — CONTRIBUTING.md
  • Run tests, linting, packaging checks — CONTRIBUTING.md
  • Using positional arguments (reformat, upload package, help) — CONTRIBUTING.md
  • Authors and maintainers — README.md
  • Documentation — README.md
  • End-to-end examples — README.md
  • How to install — README.md
  • Autograd Lecture — docs/tutorial.md
  • Autograd tutorial — docs/tutorial.md
  • Complete example: logistic regression — docs/tutorial.md
  • Complex numbers — docs/tutorial.md
  • Don't use — docs/tutorial.md
  • Extend Autograd by defining your own primitives — docs/tutorial.md
  • How can you support ifs, while loops and recursion? — docs/tutorial.md
  • How to use Autograd — docs/tutorial.md
  • Motivation — docs/tutorial.md
  • Reverse mode differentiation — docs/tutorial.md
  • Support — docs/tutorial.md
  • Supported and unsupported parts of numpy/scipy — docs/tutorial.md
  • TL;DR: Do use — docs/tutorial.md
  • What can Autograd differentiate? — docs/tutorial.md
  • What's going on under the hood? — docs/tutorial.md
  • Autograd v1.2 update guide — docs/updateguide.md
  • Gradient checking — docs/updateguide.md
  • New defvjp interface — docs/updateguide.md
  • Reasoning for the changes — docs/updateguide.md
  • Autograd examples — examples/README.md
  • Usage instructions — examples/README.md

Types and modules

  • ContainerVSpace — autograd/builtins.py
  • DictBox — autograd/builtins.py
  • DictMeta — autograd/builtins.py
  • DictVSpace — autograd/builtins.py
  • ListMeta — autograd/builtins.py
  • ListVSpace — autograd/builtins.py
  • NamedTupleVSpace — autograd/builtins.py
  • SequenceBox — autograd/builtins.py
  • SequenceVSpace — autograd/builtins.py
  • TupleMeta — autograd/builtins.py
  • TupleVSpace — autograd/builtins.py
  • dict — autograd/builtins.py
  • list — autograd/builtins.py
  • tuple — autograd/builtins.py
  • JVPNode — autograd/core.py
  • SparseBox — autograd/core.py
  • SparseObject — autograd/core.py
  • VJPNode — autograd/core.py
  • VSpace — autograd/core.py
  • ConstGraphNode — autograd/misc/tracers.py
  • FullGraphNode — autograd/misc/tracers.py
  • ArrayBox — autograd/numpy/numpy_boxes.py
  • ArrayVSpace — autograd/numpy/numpy_vspaces.py
  • ComplexArrayVSpace — autograd/numpy/numpy_vspaces.py
  • EigResultVSpace — autograd/numpy/numpy_vspaces.py
  • EighResultVSpace — autograd/numpy/numpy_vspaces.py
  • QRResultVSpace — autograd/numpy/numpy_vspaces.py
  • SVDResultVSpace — autograd/numpy/numpy_vspaces.py
  • SlogdetResultVSpace — autograd/numpy/numpy_vspaces.py
  • IntdtypeSubclass — autograd/numpy/numpy_wrapper.py
  • c_class — autograd/numpy/numpy_wrapper.py
  • r_class — autograd/numpy/numpy_wrapper.py
  • Box — autograd/tracer.py
  • Node — autograd/tracer.py
  • TraceStack — autograd/tracer.py
  • RNNSuite — benchmarks/bench_rnn.py
  • WeightsParser — examples/convnet.py
  • conv_layer — examples/convnet.py
  • full_layer — examples/convnet.py
  • maxpool_layer — examples/convnet.py

Functions

  • container_take — autograd/builtins.py
  • container_untake — autograd/builtins.py
  • fwd_grad_make_sequence — autograd/builtins.py
  • get — autograd/builtins.py
  • grad_container_take — autograd/builtins.py
  • grad_sequence_extend_left — autograd/builtins.py
  • grad_sequence_extend_right — autograd/builtins.py
  • index — autograd/builtins.py
  • items — autograd/builtins.py
  • iteritems — autograd/builtins.py
  • iterkeys — autograd/builtins.py
  • itervalues — autograd/builtins.py
  • keys — autograd/builtins.py
  • make_sequence — autograd/builtins.py
  • mut_add — autograd/builtins.py
  • ones — autograd/builtins.py
  • randn — autograd/builtins.py
  • sequence_extend_left — autograd/builtins.py
  • sequence_extend_right — autograd/builtins.py
  • size — autograd/builtins.py
  • standard_basis — autograd/builtins.py
  • values — autograd/builtins.py
  • zeros — autograd/builtins.py
  • add — autograd/core.py
  • add_outgrads — autograd/core.py
  • backward_pass — autograd/core.py
  • covector — autograd/core.py
  • def_linear — autograd/core.py
  • defgrad — autograd/core.py
  • defjvp — autograd/core.py
  • defjvp_argnum — autograd/core.py
  • defjvp_argnums — autograd/core.py
  • defvjp — autograd/core.py
  • defvjp_argnum — autograd/core.py
  • defvjp_argnums — autograd/core.py
  • defvjp_is_zero — autograd/core.py
  • defvjp_unstaged — autograd/core.py
  • deprecated_defgrad — autograd/core.py
  • deprecated_defvjp — autograd/core.py
  • deprecated_defvjp_is_zero — autograd/core.py

How things connect

  • ContainerVSpace uses_type VSpace
  • DictBox uses_type Box
  • DictMeta uses_property type_
  • DictVSpace uses_type ContainerVSpace
  • ListMeta uses_property type_
  • ListVSpace uses_type SequenceVSpace
  • NamedTupleVSpace uses_type SequenceVSpace
  • SequenceBox uses_type Box
  • SequenceVSpace uses_type ContainerVSpace
  • TupleMeta calls type
  • TupleVSpace uses_type SequenceVSpace
  • __instancecheck__ calls isinstance
  • __new__ instantiates list
  • _subval instantiates dict
  • _subval calls subvals
  • builtins.py calls defvjp
  • builtins.py calls defvjp_argnum
  • builtins.py calls defjvp
  • builtins.py calls defjvp_argnum
  • builtins.py instantiates list
  • container_untake calls isinstance
  • container_untake instantiates SparseObject
  • fwd_grad_make_sequence calls vspace
  • grad_container_take calls vspace

Folders

  • docs
  • .github
  • autograd
  • examples
  • benchmarks
  • conda_recipe
  • autograd/misc
  • autograd/numpy
  • autograd/scipy
  • examples/fluidsim
  • autograd/scipy/stats

Files

  • README.md
  • .gitignore
  • noxfile.py
  • pyproject.toml
  • CONTRIBUTING.md
  • examples/gmm.py
  • examples/ica.py
  • examples/rnn.py
  • autograd/core.py
  • autograd/util.py
  • docs/tutorial.md
  • examples/data.py
  • examples/lstm.py
  • examples/rkhs.py
  • examples/tanh.py
  • examples/gplvm.py
  • autograd/extend.py
  • autograd/tracer.py
  • examples/README.md
  • examples/graph.pdf
  • examples/hmm_em.py
  • docs/updateguide.md
  • examples/convnet.py
  • examples/ode_net.py
  • autograd/__init__.py
  • autograd/builtins.py
  • examples/__init__.py
  • examples/sinusoid.py
  • autograd/numpy/fft.py
  • autograd/wrap_util.py
  • examples/dot_graph.py
  • benchmarks/__init__.py
  • examples/data_mnist.py
  • examples/neural_net.py
  • examples/rosenbrock.py
  • .pre-commit-config.yaml