aeppl.utils.replace_rvs_in_graphs#

aeppl.utils.replace_rvs_in_graphs(graphs, replacement_fn, initial_replacements=None, **kwargs)[source]#

Replace random variables in graphs.

This will not recompute test values.

Parameters
  • graphs (Iterable[TensorVariable]) – The graphs in which random variables are to be replaced.

  • replacement_fn (Callable[[TensorVariable, Dict[TensorVariable, TensorVariable]], Dict[TensorVariable, TensorVariable]]) –

  • initial_replacements (Optional[Dict[TensorVariable, TensorVariable]]) –

Return type

Tuple[TensorVariable, Dict[TensorVariable, TensorVariable]]

Returns

  • A tuple containing the transformed graphs and a dict of the

  • replacements that were made.