-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add basic sparse handling #246
Conversation
See other examples in this package, e.g. here. ChainRulesTestUtils.jl should always be used, unless it's actually not possible for some reason.
Not clear what you mean by this. Could you clarify please?
|
rrule_test(x -> sum(sparse(x)), rand(), (rand(3,3), rand())) Should have, I thought, but maybe you could clarify |
The first element of the last argument is the value at which you want to evaluate the As regards the first argument, Finally, the second argument has to be an appropriate differential for On that note, it might be worth reading #232 if you've not already -- there's a large discussion going on about the "right" way to think about this, which might be helpful. It would be great if you could chime in with your thoughts on the matter. |
That would explain why |
That's not quite true. IIUC you've implemented an rrule for
Agreed. The issue in question has signficant ramifications for Zygote as well though -- there are currently loads of rules implemented there that are causing the kinds of problems discussed in that issue. But that's a separate issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the contribution!
I think @willtebbutt is helping out with testing. i've left some on the src
👍
src/rulesets/SparseArrays/array.jl
Outdated
using SparseArrays | ||
|
||
function rrule(::Type{<:SparseMatrixCSC{T,N}}, arr) where {T,N} | ||
function SparseMatrix_pullback(Δ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please can you use 4-space indenting throughout, as per the style guide? https://github.com/invenia/BlueStyle#synopsis :)
I have a current project for which I need some |
Sure, please go ahead! Apologies I missed this comment in the GitHub blackhole. I need this for a project as well, so would love to get this through. |
@sethaxen please ping me when ready for review. |
@@ -0,0 +1,15 @@ | |||
using SparseArrays |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a full review, but just so it doesn't get missed, it is the pattern of this package, inline with BlueStyle,
to do all the using
s at the top level file
Just hit this problem in JuliaGraphs/GraphNeuralNetworks.jl#113. |
@CarloLucibello i won't be able to work on this soon. Feel free to take over! |
I think this can be closed now that #579 is merged |
Questions:
rrule
for a constructor, is that a problem?