Skip to content

Commit 6a42613

Browse files
committed
added optimize kwarg to model_typed and model_warntype
1 parent 9f392a7 commit 6a42613

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/debug_utils.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -680,34 +680,34 @@ function has_static_constraints(
680680
end
681681

682682
"""
683-
model_warntype(model[, varinfo, context])
683+
model_warntype(model[, varinfo, context]; optimize=true)
684684
685685
Check the type stability of the model's evaluator, warning about any potential issues.
686686
687687
This simply calls `@code_warntype` on the model's evaluator, filling in internal arguments where needed.
688688
"""
689-
function model_warntype(model::Model, varinfo::AbstractVarInfo=VarInfo(model), context::AbstractContext=DefaultContext())
689+
function model_warntype(model::Model, varinfo::AbstractVarInfo=VarInfo(model), context::AbstractContext=DefaultContext(); optimize::Bool=true)
690690
args, kwargs = DynamicPPL.make_evaluate_args_and_kwargs(model, varinfo, context)
691691
return if isempty(kwargs)
692-
InteractiveUtils.@code_warntype model.f(args...)
692+
InteractiveUtils.@code_warntype optimize=optimize model.f(args...)
693693
else
694-
InteractiveUtils.@code_warntype model.f(args...; kwargs...)
694+
InteractiveUtils.@code_warntype optimize=optimize model.f(args...; kwargs...)
695695
end
696696
end
697697

698698
"""
699-
model_typed(model[, varinfo, context])
699+
model_typed(model[, varinfo, context]; optimize=true)
700700
701701
Return the type inference for the model's evaluator.
702702
703703
This simply calls `@code_typed` on the model's evaluator, filling in internal arguments where needed.
704704
"""
705-
function model_typed(model::Model, varinfo::AbstractVarInfo=VarInfo(model), context::AbstractContext=DefaultContext())
705+
function model_typed(model::Model, varinfo::AbstractVarInfo=VarInfo(model), context::AbstractContext=DefaultContext(); optimize::Bool=true)
706706
args, kwargs = DynamicPPL.make_evaluate_args_and_kwargs(model, varinfo, context)
707707
return if isempty(kwargs)
708-
InteractiveUtils.@code_typed model.f(args...)
708+
InteractiveUtils.@code_typed optimize=optimize model.f(args...)
709709
else
710-
InteractiveUtils.@code_typed model.f(args...; kwargs...)
710+
InteractiveUtils.@code_typed optimize=optimize model.f(args...; kwargs...)
711711
end
712712
end
713713

0 commit comments

Comments
 (0)