Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
torfjelde committed Nov 29, 2024
1 parent 46ea18c commit c20ede3
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/logdensityfunction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,20 @@ function LogDensityFunction(
return LogDensityFunction(varinfo, model, SamplingContext(sampler, context))
end

function LogDensityFunction(
model::Model,
context::Union{Nothing,AbstractContext}=nothing,
)
function LogDensityFunction(model::Model, context::Union{Nothing,AbstractContext}=nothing)
# Determine the suitable varinfo for the given model and context.
varinfo = determine_suitable_varinfo(model, context === nothing ? leafcontext(model.context) : context)
varinfo = determine_suitable_varinfo(
model, context === nothing ? leafcontext(model.context) : context
)
return LogDensityFunction(varinfo, model, context)
end

function LogDensityFunction(
model::Model,
varinfo::AbstractVarInfo,
context::Union{Nothing,AbstractContext}=nothing,
model::Model, varinfo::AbstractVarInfo, context::Union{Nothing,AbstractContext}=nothing
)
return LogDensityFunction(varinfo, model, context)
end


# If a `context` has been specified, we use that. Otherwise we just use the leaf context of `model`.
function getcontext(f::LogDensityFunction)
return f.context === nothing ? leafcontext(f.model.context) : f.context
Expand Down

0 comments on commit c20ede3

Please sign in to comment.