latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
tensorplay.func.linearize
- tensorplay.func.linearize(func: Callable, *primals) tuple[Any, Callable]
Evaluates
funcatprimalsand returns its linear approximation there.The primal evaluation happens once, here; the returned
jvp_fnreuses that linearization, so applying it to many tangents costs only the tangent passes. Use it in place of repeatedjvp()calls at a fixed point.- Returns:
(output, jvp_fn).jvp_fntakes tangents matching the structure ofprimalsand returns the directional derivative of the output.
Example
>>> x = tensorplay.randn(5) >>> out, jvp_fn = linearize(tensorplay.sin, x) >>> tangent_out = jvp_fn(tensorplay.ones(5))
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

