Skip to content

differentiable adjacency_matrix and degree #123

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

Merged
merged 11 commits into from
Feb 24, 2022
Merged

Conversation

CarloLucibello
Copy link
Member

Fix #113 for COO type

@CarloLucibello
Copy link
Member Author

related to JuliaDiff/ChainRules.jl#586

@CarloLucibello
Copy link
Member Author

The state of #113 on this branch is that we get a sparse vector instead of nothing:

julia> g = rand_graph(3, 2, graph_type=:coo);

julia> x = rand(3, g.num_nodes);

julia> e = rand(g.num_edges);

julia> function forward_fused(g, x, e)
           out = propagate(e_mul_xj, g, +; xj=x, e=e)
           return sum(abs2, out)
       end
forward_fused (generic function with 1 method)

julia> gradient(e -> forward_fused(g, x, e), e)[1]
2-element SparseVector{Float64, Int64} with 2 stored entries:
  [1]  =  2.22276
  [2]  =  0.489046

While this is a clear improvement it is still not ideal, we want a dense gradient returned.

@codecov
Copy link

codecov bot commented Feb 20, 2022

Codecov Report

Merging #123 (c6e3a8e) into master (309b88e) will increase coverage by 1.21%.
The diff coverage is 96.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #123      +/-   ##
==========================================
+ Coverage   84.12%   85.34%   +1.21%     
==========================================
  Files          15       15              
  Lines        1266     1262       -4     
==========================================
+ Hits         1065     1077      +12     
+ Misses        201      185      -16     
Impacted Files Coverage Δ
src/GNNGraphs/gatherscatter.jl 75.00% <ø> (ø)
src/GNNGraphs/convert.jl 90.40% <91.66%> (+0.31%) ⬆️
src/GNNGraphs/query.jl 93.02% <100.00%> (+0.04%) ⬆️
src/GNNGraphs/utils.jl 75.24% <100.00%> (+0.50%) ⬆️
src/layers/conv.jl 79.35% <100.00%> (+1.01%) ⬆️
src/utils.jl 100.00% <100.00%> (+23.72%) ⬆️
src/GNNGraphs/transform.jl 96.27% <0.00%> (-0.47%) ⬇️

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 309b88e...c6e3a8e. Read the comment docs.

@CarloLucibello CarloLucibello merged commit dd4a54c into master Feb 24, 2022
@CarloLucibello CarloLucibello changed the title differentiable adjacency_matrix for coo differentiable adjacency_matrix and degree Feb 24, 2022
@CarloLucibello
Copy link
Member Author

Opened an issue in Zygote FluxML/Zygote.jl#1174

@CarloLucibello CarloLucibello deleted the cl/edgegrad branch March 23, 2022 07:55
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.

Gradient of edge weights is nothing with fused e_mul_xj
1 participant