Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.42.5

Fixed `apply_transform_strategy` to accumulate only the target fixed transform's forward log-Jacobian when converting from `DynamicLink`. Previously, the source inverse Jacobian was also included, producing incorrect internal log densities.

# 0.42.4

`arraydist` on a vector of univariate distributions now builds its `Distributions.Product` through the inner constructor instead of `Product(dists)`, which is deprecated. The outer constructor calls `Base.depwarn`, and that walks a backtrace on every call, so models with an `arraydist` likelihood paid it once per evaluation. The return type is unchanged.
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "DynamicPPL"
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
version = "0.42.4"
version = "0.42.5"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
5 changes: 1 addition & 4 deletions src/transformed_values.jl
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,7 @@ function apply_transform_strategy(
fwd_transform = inverse(target.transform)
transformed_value, logjac = with_logabsdet_jacobian(fwd_transform, raw_value)
transformed_tv = TransformedValue(transformed_value, target)
# TODO: https://github.com/TuringLang/DynamicPPL.jl/issues/1407
# Likely should return `logjac` rather than `logjac - inv_logjac`; the sibling
# branches all return only the target's forward Jacobian.
(raw_value, transformed_tv, logjac - inv_logjac)
(raw_value, transformed_tv, logjac)
else
error("unknown target transform: $target")
end
Expand Down
4 changes: 4 additions & 0 deletions test/transformed_values.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ end

# Matching transform should work
strategy_ok = DynamicPPL.WithTransforms(VarNamedTuple(; x=ft), UnlinkAll())
_, _, dynamic_to_fixed_logjac = DynamicPPL.apply_transform_strategy(
strategy_ok, TransformedValue(linked_val, DynamicLink()), vn, dist
)
@test dynamic_to_fixed_logjac ≈ logjac
new_raw, new_tv, new_logjac = DynamicPPL.apply_transform_strategy(
strategy_ok, tv, vn, dist
)
Expand Down
Loading