Class ChannelInfo
Describes a channel, i.e. an edge in a factor graph.
Implements
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Compiler.Transforms
Assembly: Microsoft.ML.Probabilistic.Compiler.dll
Syntax
public class ChannelInfo : ICompilerAttribute
Remarks
A channel connects a model variable to a factor. A channel is either a definition, a use, or a replicated use of a model variable.
A definition channel connects a model variable to its unique defining factor. A definition channel appears in the inference program as a program variable having the same type as the model variable.
A use channel connects a model variable to a child factor. A use channel appears in the inference program as an array of the variable type. It is indexed via [usage indices][variable indices] where the variable indices are only needed if the variable is an array.
All uses of a model variable are given the same ChannelInfo and packed into an array in the inference program.
For example, if a model variable x has type double
and 2 uses, its usage channels will be declared together as double[] x_uses = new double[3];
and referred to as x_uses[0] and x_uses[1].
The model variable type can be an array, in which case each channel is an array.
For example, if a model variable x has type double[]
and 2 uses, its usage channels will be declared together
as double[][] x_uses = new double[2][];
and referred to as x_uses[0] and x_uses[1].
If the model variable is inside of a plate, then all instances of the channel share the same ChannelInfo and are
packed into a nested array in the inference program.
For example, if a model variable x is in a plate of size 3 and has 2 uses, its usage channels will be
declared together as double[][] x_uses = new double[2][];
and x_uses[0] refers to the first use of x in the plate.
Fields
IsMarginal
Marks a channel as a marginal
Declaration
public readonly bool IsMarginal
Field Value
Type | Description |
---|---|
Boolean |
Properties
IsDef
True if the channel is a definition channel.
Declaration
public bool IsDef { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsUse
True if the channel is a usage channel.
Declaration
public bool IsUse { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
ReplaceWithUsesChannel(IExpression, IExpression)
Declaration
public IExpression ReplaceWithUsesChannel(IExpression expr, IExpression usageIndex)
Parameters
Type | Name | Description |
---|---|---|
IExpression | expr | |
IExpression | usageIndex |
Returns
Type | Description |
---|---|
IExpression |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |