latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
tensorplay.func.jacfwd
- tensorplay.func.jacfwd(func: Callable, argnums: int | tuple[int, ...] = 0, has_aux: bool = False, *, randomness: str = 'error')
Returns a function computing the Jacobian of
funcby forward mode.Forward mode costs one pass per input element, so
jacfwdis the cheaper direction when the input is smaller than the output – the mirror image ofjacrev().- Parameters:
func (Callable) – a Python function returning one or more tensors.
argnums (int or Tuple[int]) – which positional arguments to differentiate with respect to. Default: 0.
has_aux (bool) – whether
funcreturns(output, aux).randomness (str) – how the underlying map treats random operations; one of
"error","different"or"same".
Example
>>> jacobian = jacfwd(tensorplay.sin)(tensorplay.randn(5))
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

