Skip to content

Commit

Permalink
Remove incorrect mapvcat Zygote adjoint (#362)
Browse files Browse the repository at this point in the history
* Remove mapvcat Zygote manual adjoint

* Add test for Stacked with vectors

* Bump patch version to 0.15.4
  • Loading branch information
mhauru authored Jan 15, 2025
1 parent c3fe929 commit df3695c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Bijectors"
uuid = "76274a88-744f-5084-9051-94815aaf08c4"
version = "0.15.3"
version = "0.15.4"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand Down
5 changes: 0 additions & 5 deletions ext/BijectorsZygoteExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ using Bijectors:
find_alpha,
pd_logpdf_with_trans,
istraining,
mapvcat,
eachcolmaphcat,
sumeachcol,
pd_link,
Expand All @@ -36,10 +35,6 @@ using Bijectors.Distributions: LocationScale

@adjoint istraining() = true, _ -> nothing

@adjoint function mapvcat(f, args...)
g(f, args...) = map(f, args...)
return pullback(g, f, args...)
end
@adjoint function eachcolmaphcat(f, x1, x2)
function g(f, x1, x2)
init = reshape(f(view(x1, :, 1), x2[1]), :, 1)
Expand Down
11 changes: 11 additions & 0 deletions test/ad/stacked.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,15 @@
test_ad(y) do y
sum(transform(binv, y))
end

bvec = Stacked([b1, b2], [1:4, 5:5])
bvec_inv = inverse(bvec)

test_ad(y) do x
sum(transform(bvec, binv(x)))
end

test_ad(y) do y
sum(transform(bvec_inv, y))
end
end

2 comments on commit df3695c

@mhauru
Copy link
Member Author

@mhauru mhauru commented on df3695c Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

Fix a bug that affected the Stacked bijector when using Zygote.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/123100

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.15.4 -m "<description of version>" df3695cd5e4650e7fc6c819774f445878d8b4371
git push origin v0.15.4

Please sign in to comment.