TensorPlay
latest (dev)
Copy
View Markdown

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 func by forward mode.

Forward mode costs one pass per input element, so jacfwd is the cheaper direction when the input is smaller than the output – the mirror image of jacrev().

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 func returns (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))

On this page

Ask DeepWiki