explaingit

hips/autograd

7,488PythonAudience · researcherComplexity · 2/5Setup · easy

TLDR

Python library that automatically computes exact derivatives of functions written in standard Python and NumPy, handles loops, branches, and recursion without any code rewriting, developed at Harvard.

Mindmap

mindmap
  root((autograd))
    What it does
      Auto differentiation
      Exact gradients
      Higher order derivs
    Handles
      Loops and branches
      Recursive functions
      NumPy arrays
    Use cases
      Neural networks
      Optimization
      Scientific computing
    Integration
      NumPy compatible
      SciPy optional
      pip install
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Train a neural network written in plain Python and NumPy without setting up a full deep learning framework like PyTorch.

USE CASE 2

Compute exact gradients for a custom mathematical optimization problem written in standard Python code.

USE CASE 3

Calculate higher-order derivatives for scientific computing or physics simulations where you need derivatives of derivatives.

USE CASE 4

Wrap existing NumPy-based code to get automatic gradient computation for optimization algorithms without rewriting it.

Tech stack

PythonNumPySciPypip

Getting it running

Difficulty · easy Time to first run · 5min
No license information specified in the README.

In plain English

Autograd is a Python library that automatically computes derivatives of mathematical functions written using standard Python and NumPy code. In math and machine learning, a derivative measures how much a function's output changes when you adjust its inputs, and computing derivatives is central to training neural networks and many optimization algorithms. Normally, computing derivatives requires either doing the math by hand or using slow numerical approximation methods. Autograd takes a different approach: you write your function in ordinary Python, and the library traces through what your code does to work out the exact derivative automatically. It handles loops, conditional branches, and even recursive functions, all without you rewriting anything in a special notation. The library supports computing gradients of functions that take in large arrays of numbers and return a single number, which covers the most common need in machine learning. It also supports forward-mode differentiation and can compute higher-order derivatives, meaning derivatives of derivatives. Installation is a single pip command. The repository includes example code for training neural networks, convolutional networks, recurrent networks, and a fluid simulation, giving concrete illustrations of what the library can do. Optional integration with SciPy is available for users who need those extra mathematical tools. Autograd was developed at Harvard and is aimed at researchers and engineers working on mathematical optimization, machine learning, or scientific computing who want to write ordinary Python code and get exact gradients without extra ceremony.

Copy-paste prompts

Prompt 1
Using hips/autograd, write Python code that trains a simple two-layer neural network using gradient descent, computing weight gradients automatically with autograd.grad.
Prompt 2
I have a NumPy function that computes a physics simulation loss. Show me how to use autograd to get its gradient so I can run gradient-based optimization on the simulation parameters.
Prompt 3
Using autograd, compute the Hessian of a scalar function that takes a vector input, then use it to implement one step of Newton's method for optimization.
Prompt 4
Convert this NumPy function that uses a for loop and an if statement into an autograd-compatible version I can differentiate with respect to its inputs.
Open on GitHub → Explain another repo

← hips on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.