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.Parameter

  • acc (Tuple[str, TypeVar(State)]) – Tuple of path and state

  • update_cb (Callable[[TypeVar(TraverseInput, Variable, Module, Parameter), str, TypeVar(State)], TypeVar(State)]) – Callable

  • target_types (Tuple[Type[Any], ...]) – target class types

Return type

TypeVar(State)

Returns