neurai.opt package#
Submodules#
- neurai.opt.update.apply_updates(model, updates)#
Applies an update to the corresponding parameters.
This is a utility functions that applies an update to a set of parameters, and then returns the updated parameters to the caller. As an example, the update may be a gradient transformed by a sequence of`GradientTransformations`. This function is exposed for convenience, but it just adds updates and parameters; you may also apply updates to parameters manually, using tree_map (e.g. if you want to manipulate updates in custom ways before applying them).
- Parameters:
params – a tree of parameters.
updates (
Union
[Array
,ndarray
,bool_
,number
,Iterable
[ArrayTree],Mapping
[Any
, ArrayTree]]) – a tree of updates, the tree structure and the shape of the leafparams. (nodes must match that of) –
model (
Union
[Array
,ndarray
,bool_
,number
,Iterable
[ArrayTree],Mapping
[Any
, ArrayTree]]) –
- Return type:
Union
[Array
,ndarray
,bool_
,number
,Iterable
[ArrayTree],Mapping
[Any
, ArrayTree]]- Returns:
Updated parameters, with same structure, shape and type as params.