Skip to content

Commit 585027b

Browse files
committed
Warn in check_model if model is empty
1 parent a69e03a commit 585027b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

HISTORY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
`varinfo[:]` now returns an empty vector if `varinfo::DynamicPPL.NTVarInfo` is empty, rather than erroring.
66

7+
In its place, `check_model` now issues a warning if the model is empty.
8+
79
## 0.36.4
810

911
Added compatibility with DifferentiationInterface.jl 0.7, and also with JET.jl 0.10.

src/debug_utils.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ function conditioned_varnames(context)
338338
end
339339

340340
function check_varnames_seen(varnames_seen::AbstractDict{VarName,Int})
341+
if isempty(varnames_seen)
342+
@warn "The model does not contain any parameters."
343+
return true
344+
end
345+
341346
issuccess = true
342347
for (varname, count) in varnames_seen
343348
if count == 0

0 commit comments

Comments
 (0)