Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use ProjectTo in Array addition #578

Closed
wants to merge 2 commits into from
Closed

Conversation

oxinabox
Copy link
Member

the reshape was a primative version of ProjectTo i think?

@github-actions github-actions bot added the needs version bump Version needs to be incremented or set to -DEV in Project.toml label Jan 21, 2022
@mcabbott
Copy link
Member

I see it has test_rrule(+, randn(3), randn(3,1), randn(3,1,1)) for this reshape, but maybe test Diagonal + Matrix or something?

@oxinabox
Copy link
Member Author

I added

        test_rrule(+, randn(3,3), Diagonal(randn(3)), randn(3,3,1))
        test_rrule(+, randn(3,3), Diagonal(randn(3)), Symmetric(randn(3,3)))

and interestingly both fail.
So some debugging to do there

@mcabbott
Copy link
Member

mcabbott commented Feb 12, 2022

The bug is that this doesn't work:

julia> ProjectTo(Diagonal([1,2,3]))(randn(3,3,1))
ERROR: MethodError: no method matching (::ProjectTo{Diagonal, ... }}}}}}}})(::Array{Float64, 3})

julia> Diagonal(randn(3)) + randn(3,3,1)  # but this does
3×3×1 Array{Float64, 3}:

Fixed in JuliaDiff/ChainRulesCore.jl@a327838

@mcabbott
Copy link
Member

The fix is part of JuliaDiff/ChainRulesCore.jl#446, BTW. Which I think should be merged.

@oxinabox
Copy link
Member Author

oxinabox commented Feb 12, 2024

Closing infavor of #783 because I can't be bothered rebasing

@oxinabox oxinabox closed this Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs version bump Version needs to be incremented or set to -DEV in Project.toml
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants