Skip to content

Commit 0b08237

Browse files
committed
Fix setlogp!! with single scalar to error
1 parent 7b7a3e2 commit 0b08237

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

HISTORY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This release overhauls how VarInfo objects track variables such as the log joint
1616
- `set/reset/increment_num_produce!` have become `set/reset/increment_num_produce!!` (note the second exclamation mark). They are no longer guaranteed to modify the `VarInfo` in place, and one should always use the return value.
1717
- `@addlogprob!` now _always_ adds to the log likelihood. Previously it added to the log probability that the execution context specified, e.g. the log prior when using `PriorContext`.
1818
- `getlogp` now returns a `NamedTuple` with keys `logprior` and `loglikelihood`. If you want the log joint probability, which is what `getlogp` used to return, use `getlogjoint`.
19-
- Correspondingly `setlogp!!` and `acclogp!!` should now be called with a `NamedTuple` with keys `logprior` and `loglikelihood`. The method with a single scalar value has been deprecated, and falls back on `setloglikelihood!!` or `accloglikelihood!!`. Corresponding setter/accumulator functions exist for the log prior as well.
19+
- Correspondingly `setlogp!!` and `acclogp!!` should now be called with a `NamedTuple` with keys `logprior` and `loglikelihood`. The `acclogp!!` method with a single scalar value has been deprecated and falls back on `accloglikelihood!!`, and the single scalar version of `setlogp!!` has been removed. Corresponding setter/accumulator functions exist for the log prior as well.
2020

2121
## 0.36.0
2222

src/abstract_varinfo.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,10 @@ function setlogp!!(vi::AbstractVarInfo, logp::NamedTuple{names}) where {names}
224224
end
225225

226226
function setlogp!!(vi::AbstractVarInfo, logp::Number)
227-
depwarn(
228-
"`setlogp!!(vi::AbstractVarInfo, logp::Number)` is deprecated. Use `setloglikelihood!!(vi, logp)` instead.",
229-
:setlogp,
230-
)
231-
return setloglikelihood!!(vi, logp)
227+
return error("""
228+
`setlogp!!(vi::AbstractVarInfo, logp::Number)` is no longer supported. Use
229+
`setloglikelihood!!` and/or `setlogprior!!` instead.
230+
""")
232231
end
233232

234233
"""

test/varinfo.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ end
220220
vi = setlogprior!!(vi, -1.0)
221221
getlogprior(vi) == -1.0
222222
end
223-
@test_throws "has no field LogLikelihood" setlogp!!(getlogp(vi))
224223

225224
vi = last(
226225
DynamicPPL.evaluate!!(m, DynamicPPL.setaccs!!(deepcopy(vi), (NumProduce(),)))

0 commit comments

Comments
 (0)