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

extended GatedGraphConv and NNConv to use AbstactGNNGraph #375

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/layers/conv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ end
# remove after https://github.com/JuliaDiff/ChainRules.jl/pull/521
@non_differentiable fill!(x...)

function (l::GatedGraphConv)(g::GNNGraph, H::AbstractMatrix{S}) where {S <: Real}
function (l::GatedGraphConv)(g::AbstractGNNGraph, H::AbstractMatrix{S}) where {S <: Real}
Copy link
Member

Choose a reason for hiding this comment

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

just this change is not enough to make this layer compatible with heterograph

Copy link
Author

Choose a reason for hiding this comment

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

Ok, could you tell me what I should add?

Copy link
Author

Choose a reason for hiding this comment

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

and is NNConv ok or should I also modify it?

check_num_nodes(g, H)
m, n = size(H)
@assert (m<=l.out_ch) "number of input features must less or equals to output features."
Expand Down Expand Up @@ -739,11 +739,11 @@ function NNConv(ch::Pair{Int, Int}, nn, σ = identity; aggr = +, bias = true,
return NNConv(W, b, nn, σ, aggr)
end

function (l::NNConv)(g::GNNGraph, x::AbstractMatrix, e)
function (l::NNConv)(g::AbstractGNNGraph, x, e)
check_num_nodes(g, x)

m = propagate(message, g, l.aggr, l, xj = x, e = e)
return l.σ.(l.weight * x .+ m .+ l.bias)
xj, xi = expand_srcdst(g, x)
m = propagate(message, g, l.aggr, l, xj = xj, e = e)
return l.σ.(l.weight * xi .+ m .+ l.bias)
end

function message(l::NNConv, xi, xj, e)
Expand Down
Loading