latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
tensorplay.func.grad
- tensorplay.func.grad(func: Callable, argnums: int | tuple[int, ...] = 0, has_aux: bool = False) Callable
Returns a function computing the gradient of
func.funcmust return a scalar tensor; the returned function has the same signature and returns the gradient with respect toargnums. Because it is again an ordinary function of the same inputs,grad(grad(f))is the second derivative.- Parameters:
Example
>>> x = tensorplay.randn([]) >>> grad(tensorplay.sin)(x)
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

