-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formalise VarInfo
/AbstractVarInfo
API
#68
Comments
Cf. AbstractPPL discussion. I'm leaving this open for now for reference. |
Some useful discussions By @mohamed82008 #119 (comment)
|
Also, by @phipsgabler in #283
haskey(vi::SimpleVarInfo, vn) = haskey(vi.θ, getsym(vn))
istrans(::SimpleVarInfo, vn::VarName) = false
getindex(vi::SimpleVarInfo, spl::SampleFromPrior) = vi.θ
getindex(vi::SimpleVarInfo, spl::SampleFromUniform) = vi.θ
# TODO: Should we do better?
getindex(vi::SimpleVarInfo, spl::Sampler) = vi.θ
function getindex(vi::SimpleVarInfo, vn::VarName{sym}) where {sym}
value = getproperty(nt, sym)
return _getindex(value, vn.indexing)
end
getindex(vi::SimpleVarInfo, vns::AbstractArray{<:VarName}) = map(vn -> getindex(vi, vn), vns)
EDIT: |
VarInfo
VarInfo
API
See also the design document in |
Fixed by #417. See |
VarInfo
currently implements and exports a large number of APIs, which sometimes can be redundant, confusing and hard to maintain. It is helpful to have a clear boundary what is internal toVarInfo
and what can be reliably called by external modules such as sampling algorithms and the compiler itself.The text was updated successfully, but these errors were encountered: