Internal API

Index

Types

Functions

Types

TensorInference.FactorType
struct Factor{T, N}

Fields

  • vars
  • vals

Encodes a discrete function over the set of variables vars that maps each instantiation of vars into a nonnegative number in vals.

source
TensorInference.SamplesType
struct Samples{L} <: AbstractVector{SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}

Fields

  • samples::Matrix{Int64}

  • labels::Vector

The sampled configurations are stored in samples, which is a vector of vector. labels is a vector of variable names for labeling configurations.

source

Functions

TensorInference.backward_tropical!Method
backward_tropical!(
    ixs,
    xs::Tuple,
    iy,
    y,
    ymask,
    size_dict
) -> Vector{Any}

The backward rule for tropical einsum.

  • ixs and xs are labels and tensor data for input tensors,
  • iy and y are labels and tensor data for the output tensor,
  • ymask is the boolean mask for gradients,
  • size_dict is a key-value map from tensor label to dimension size.
source
TensorInference.parse_mar_solution_fileMethod
parse_mar_solution_file(
    rawlines::Vector{String};
    factor_eltype
) -> Vector{Vector{Float64}}

Parse the solution marginals of all variables from the UAI MAR solution file. The order of the variables is the same as in the model definition.

The UAI file formats are defined in: https://uaicompetition.github.io/uci-2022/file-formats/

source
TensorInference.read_query_fileMethod
read_query_file(
    query_filepath::AbstractString
) -> Vector{Int64}

Return the query variables in query_filepath. If the passed file path is an empty string, return an empty vector.

The UAI file formats are defined in: https://uaicompetition.github.io/uci-2022/file-formats/

source