Skip to content

Commit 59ee768

Browse files
committed
added edge check
1 parent 578968b commit 59ee768

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

GNNLux/src/layers/conv.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ end
655655
function (l::MEGNetConv)(g, x, e, ps, st)
656656
ϕe = StatefulLuxLayer{true}(l.ϕe, ps.ϕe, _getstate(st, :ϕe))
657657
ϕv = StatefulLuxLayer{true}(l.ϕv, ps.ϕv, _getstate(st, :ϕv))
658-
m = (; ϕe, ϕv, l.aggr)
658+
m = (; ϕe, ϕv, aggr=l.aggr)
659659
return GNNlib.megnet_conv(m, g, x, e), st
660660
end
661661

GNNLux/test/layers/conv_tests.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@
9696
"""
9797

9898
@testset "MEGNetConv" begin
99-
in_dims = 6
100-
out_dims = 8
101-
10299
l = MEGNetConv(in_dims => out_dims)
103100

104101
ps = LuxCore.initialparameters(rng, l)

GNNlib/src/layers/conv.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,18 +355,23 @@ end
355355

356356
####################### MegNetConv ######################################
357357

358-
function megnet_conv(l, g::GNNGraph, x::AbstractMatrix, e::AbstractMatrix)
358+
function megnet_conv(l, g::GNNGraph, x::AbstractMatrix, e::Union{AbstractMatrix, Nothing}=nothing)
359359
check_num_nodes(g, x)
360360

361-
= apply_edges(g, xi = x, xj = x, e = e) do xi, xj, e
361+
if isnothing(e)
362+
num_edges = g.num_edges
363+
e = zeros(eltype(x), 0, num_edges) # Empty matrix with correct number of columns
364+
end
365+
366+
ē = apply_edges(g, xi = x, xj = x, e = e) do xi, xj, e
362367
l.ϕe(vcat(xi, xj, e))
363368
end
364369

365-
xᵉ = aggregate_neighbors(g, l.aggr, )
370+
xᵉ = aggregate_neighbors(g, l.aggr, ē)
366371

367372
= l.ϕv(vcat(x, xᵉ))
368373

369-
return x̄,
374+
return x̄, ē
370375
end
371376

372377
####################### GMMConv ######################################

0 commit comments

Comments
 (0)