hessian#

class brainpy.math.hessian(func, grad_vars=None, argnums=None, return_value=False, holomorphic=False, dyn_vars=None, child_objs=None)[source]#

Hessian of func as a dense array.

Parameters:
  • func (callable, function) – Function whose Hessian is to be computed. Its arguments at positions specified by argnums should be arrays, scalars, or standard Python containers thereof. It should return arrays, scalars, or standard Python containers thereof.

  • grad_vars (optional, ArrayCollector, sequence of ArrayType) – The variables required to compute their gradients.

  • argnums (Optional, integer or sequence of integers) – Specifies which positional argument(s) to differentiate with respect to (default 0).

  • holomorphic (bool) – Indicates whether fun is promised to be holomorphic. Default False.

  • return_value (bool) – Whether return the hessian values.

  • dyn_vars (optional, ArrayType, sequence of ArrayType, dict) –

    The dynamically changed variables used in func.

    Deprecated since version 2.4.0: No longer need to provide dyn_vars. This function is capable of automatically collecting the dynamical variables used in the target func.

  • child_objs (optional, BrainPyObject, sequnce, dict) –

    New in version 2.3.1.

    Deprecated since version 2.4.0: No longer need to provide child_objs. This function is capable of automatically collecting the children objects used in the target func.

Returns:

obj – The transformed object.

Return type:

ObjectTransform