- class aeppl.rewriting.PreserveRVMappings(rv_values)#
Keeps track of random variables and their respective value variables during graph rewrites in
When a random variable is replaced in a rewrite, this
Featureautomatically updates the
rv_valuesmapping, so that the new variable is linked to the original value variable.
In addition this
Featureprovides functionality to manually update a random and/or value variable. A mapping from the transformed value variables to the the original value variables is kept in
measurable_conversionsmap is maintained, which holds information about un-valued and un-measurable variables that were replaced with measurable variables. This information can be used to revert these rewrites.
- type rv_values
Create a clone that can be attached to a new
FunctionGraph.attach_feature, the method that attaches the feature to the
Whenever a node is replaced during rewrite, we check if it had a value variable associated with it and map it to the new node.
PreserveRVMappings.on_import(fgraph, node, ...)
Called whenever a node is imported into
fgraph, which is just before the node is actually connected to the graph.
PreserveRVMappings.on_prune(fgraph, node, reason)
Called whenever a node is pruned (removed) from the
fgraph, after it is disconnected from the graph.
Update mappings for a random variable.