Skip to main content

Infer.NET development

Compiler transforms

This page collects documentation on the Infer.NET compiler transforms.

Transform Summary
Gate Handles if and switch statements with stochastic arguments.
Indexing Converts constant array indexing such as a[0] into a separate variable a_item0.
Depth cloning Clones variables to ensure that each is used at a fixed depth.
Replication Replicates any variables which are referenced in a loop, so that each reference is a unique variable.
Variable Inserts variable factors, splitting each variable into a definition, use, and marginal.
If cutting Splits if statements.
Channel Converts variables so that each reference becomes a unique channel variable, corresponding to an edge in the factor graph.
Group Converts GroupMember attributes into ChannelPath attributes
Hybrid algorithm Allows different algorithms to be applied to different parts of the graph. Inserts operators at algorithm boundaries to transform the messages of one algorithm into messages suitable for another.
Message Transforms a model specified in terms of channels into the set of message passing operations required to perform inference in that model.
Message optimisation Removes duplicate messages or redundant message operations.
Loop cutting Splits for loops and promotes variables declared in loops to the top level.
Dependency analysis Determines dependencies between statements in the code.
Pruning Removes statements whose result is never used by an output, and removes updates whose result is uniform.
Iteration Creates while(true) loops around statement blocks with cyclic dependencies. Statements not in loops, and the loops themselves, are topologically sorted.
Scheduling Re-orders statements within while(true) loops to respect their dependency requirements.
Dead code elimination Post-optimization of the schedule. Removes statements whose result is never used.
Iterative process Converts an inference method into a class which implements IGeneratedAlgorithm. Promotes local variables to fields and places parts of the inference into different methods.
Loop merging Optimizes the generated code by merging consecutive for loops over the same range into one for loop.