gpflow.utilities.traversal#
Functions#
gpflow.utilities.traversal.traverse_module#
- gpflow.utilities.traversal.traverse_module(m, acc, update_cb, target_types)[source]#
Recursively traverses m, accumulating in acc a path and a state until it finds an object of type in target_types to apply update_cb to update the accumulator acc and/or the object.
- Parameters
m (
TypeVar
(TraverseInput
,Variable
,Module
,Parameter
)) – tf.Module, tf.Variable or gpflow.Parameteracc (
Tuple
[str
,TypeVar
(State
)]) – Tuple of path and stateupdate_cb (
Callable
[[TypeVar
(TraverseInput
,Variable
,Module
,Parameter
),str
,TypeVar
(State
)],TypeVar
(State
)]) – Callabletarget_types (
Tuple
[Type
[Any
],...
]) – target class types
- Return type
TypeVar
(State
)- Returns