Skip to content

Commit e3fbd2d

Browse files
committed
Revert "Implement returned(model, xs...)"
Accidentally committed to main, meant to open a PR. This reverts commit 7bdc71e.
1 parent 7bdc71e commit e3fbd2d

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

HISTORY.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# DynamicPPL Changelog
22

3-
## 0.39.2
4-
5-
`returned(model, parameters...)` now accepts any arguments that can be wrapped in `InitFromParams` (previously it would only accept `NamedTuple`, `AbstractDict{<:VarName}`, or a chain).
6-
73
## 0.39.1
84

95
`LogDensityFunction` now allows you to call `logdensity_and_gradient(ldf, x)` with `AbstractVector`s `x` that are not plain Vectors (they will be converted internally before calculating the gradient).

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DynamicPPL"
22
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
3-
version = "0.39.2"
3+
version = "0.39.1"
44

55
[deps]
66
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

src/model.jl

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,16 +1153,10 @@ end
11531153
function predict end
11541154

11551155
"""
1156-
returned(model::Model, parameters...)
1156+
returned(model::Model, parameters::NamedTuple)
1157+
returned(model::Model, parameters::AbstractDict{<:VarName})
11571158
1158-
Initialise a `model` using the given `parameters` and return the model's return value. The
1159-
parameters must be provided in a format that can be wrapped in an `InitFromParams`, i.e.,
1160-
`InitFromParams(parameters..., nothing)` must be a valid `AbstractInitStrategy` (where
1161-
`nothing` is the fallback strategy to use if parameters are not provided).
1162-
1163-
As far as DynamicPPL is concerned, `parameters` can be either a singular `NamedTuple` or an
1164-
`AbstractDict{<:VarName}`; however this method is left flexible to allow for other packages
1165-
that wish to extend `InitFromParams`.
1159+
Execute `model` with variables `keys` set to `values` and return the values returned by the `model`.
11661160
11671161
# Example
11681162
```jldoctest
@@ -1183,7 +1177,7 @@ julia> returned(model, Dict{VarName,Float64}(@varname(m) => 2.0))
11831177
(mp1 = 3.0,)
11841178
```
11851179
"""
1186-
function returned(model::Model, parameters::Any)
1180+
function returned(model::Model, parameters::Union{NamedTuple,AbstractDict{<:VarName}})
11871181
# Note: we can't use `fix(model, parameters)` because
11881182
# https://github.com/TuringLang/DynamicPPL.jl/issues/1097
11891183
return first(
@@ -1192,7 +1186,7 @@ function returned(model::Model, parameters::Any)
11921186
DynamicPPL.OnlyAccsVarInfo(DynamicPPL.AccumulatorTuple()),
11931187
# Use `nothing` as the fallback to ensure that any missing parameters cause an
11941188
# error
1195-
InitFromParams(parameters..., nothing),
1189+
InitFromParams(parameters, nothing),
11961190
),
11971191
)
11981192
end

0 commit comments

Comments
 (0)