Skip to content

Conversation

@mcabbott
Copy link
Member

#533 enforces that I is its own tangent. Since this package still allows Julia 1.0, and the current ChainRules does not, this apparently breaks DistributionsAD on Julia 1.5.

This PR is one way to avoid that. It would need to be in one release before dropping 1.0 forever.

However, since there has been exactly one release with #533 in it (list https://github.com/JuliaDiff/ChainRulesCore.jl/releases/) the alternative would just be to edit one line in the registry to make that release 1.6-only. And make all new releases here 1.6 only too, which we should probably do in any case.

You could also mess with releases on multiple branches, but that sounds harder.

ProjectTo(x::UniformScaling) = ProjectTo{UniformScaling}(; λ=ProjectTo(x.λ))
ProjectTo(x::UniformScaling{Bool}) = ProjectTo(false)
(pr::ProjectTo{UniformScaling})(dx::UniformScaling) = UniformScaling(pr.λ(dx.λ))
(pr::ProjectTo{UniformScaling})(dx::Tangent{<:UniformScaling}) = UniformScaling(pr.λ(dx.λ))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
(pr::ProjectTo{UniformScaling})(dx::Tangent{<:UniformScaling}) = UniformScaling(pr.λ(dx.λ))
function (pr::ProjectTo{UniformScaling})(dx::Tangent{<:UniformScaling})
return UniformScaling(pr.λ(dx.λ))
end

@mcabbott mcabbott mentioned this pull request Feb 20, 2022
mcabbott and others added 3 commits February 20, 2022 10:05
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@codecov-commenter
Copy link

codecov-commenter commented Feb 20, 2022

Codecov Report

Merging #542 (de84f62) into main (3394de6) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #542   +/-   ##
=======================================
  Coverage   93.41%   93.41%           
=======================================
  Files          15       15           
  Lines         866      866           
=======================================
  Hits          809      809           
  Misses         57       57           
Impacted Files Coverage Δ
src/projection.jl 97.30% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3394de6...de84f62. Read the comment docs.

@mcabbott mcabbott marked this pull request as ready for review February 20, 2022 15:17
@mzgubic
Copy link
Member

mzgubic commented Feb 21, 2022

You could also mess with releases on multiple branches, but that sounds harder.

Why is it harder? Can we not just register a tag from a branch?

If we merge this PR, and then bump the compat to 1.6 we have to at that point undo the changes this PR introduced.

(pr::ProjectTo{UniformScaling})(dx::Tangent{<:UniformScaling}) = UniformScaling(pr.λ(dx.λ))
if VERSION >= v"1.6"
# UniformScaling can represent its own cotangent
# but shouldn't on Julia 1.0, as rules in CR.jl were added only after mioving to 1.6
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# but shouldn't on Julia 1.0, as rules in CR.jl were added only after mioving to 1.6
# but shouldn't on Julia 1.0, as rules in CR.jl were added only after moving to 1.6

@oxinabox
Copy link
Member

@mzgubic do you think we should just go and backport the missing rules into CR and tag a backported release?

@mzgubic
Copy link
Member

mzgubic commented Feb 23, 2022

Yes, I can do that. Let's merge #544 and I will backport JuliaDiff/ChainRules.jl#571 to ChainRules 1.21, as it was before https://github.com/JuliaDiff/ChainRules.jl/pull/577/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants