gpflow.utilities.traversal

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, Any]) – Tuple of path and state

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

  • target_types (tuple) – target class types

Return type

Tuple[str, Any]

Returns