liveBook · Manning

Directional derivative

As explained in Deep Learning with JAX

The derivative of a function in a specified input direction, often used to explain Jacobian-vector products.

A directional derivative measures a function’s slope at a point while moving in a chosen input direction. Unlike a partial derivative, which follows one coordinate axis, it accepts any direction vector. In JAX, pass that vector as the tangent to jax.jvp() and obtain the derivative in one forward pass without constructing the full Jacobian. section 4.3.2

Compute a directional derivative

For f(x1, x2) = x1x2 + sin(x1x2) at (7, 2), use jax.jvp(f, (7.0, 2.0), (1.0, 0.0)). The primal output is 14.990607 and the tangent output is 2.2734745, the slope in the positive x1 direction. Replacing the tangent with another vector measures a different direction. section 4.3.2

How Deep Learning with JAX covers it

How deep it goes
Defines arbitrary tangent directions and demonstrates jvp(), but stops short of a broader implementation treatment.
Examples
Uses a two-variable product-plus-sine function and a three-variable vector-valued function with several tangent vectors.
What it assumes
Assumes partial derivatives and introduces arbitrary direction vectors through forward-mode autodiff.
What you can do after
Apply it via JAX’s jax.jvp() to calculate directional slopes and recover Jacobian columns.
How it connects
Connects partial derivatives, forward-mode autodiff, Jacobians, and Jacobian-vector products.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with JAX. The section links point to the parts of the book it draws on.