Skip to content

Commit e76d150

Browse files
committed
Fixes
1 parent 4adef57 commit e76d150

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

GNNLux/src/layers/pool.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Networks](https://arxiv.org/abs/1511.05493) paper
5151
\mathbf{u}_V = \sum_{i\in V} \alpha_i\, f_{feat}(\mathbf{x}_i)
5252
```
5353
54-
where the coefficients ``\alpha_i`` are given by a [`softmax_nodes`](@ref)
54+
where the coefficients ``\alpha_i`` are given by a [`GNNLib.softmax_nodes`](@ref)
5555
operation:
5656
5757
```math
@@ -92,9 +92,9 @@ u, st = pool(g, g.ndata.x, ps, st)
9292
@assert size(u) == (chout, g.num_graphs)
9393
```
9494
"""
95-
struct GlobalAttentionPool{G, F}
96-
fgate::G
97-
ffeat::F
95+
struct GlobalAttentionPool <: GNNContainerLayer{(:fgate, :ffeat)}
96+
fgate
97+
ffeat
9898
end
9999

100100
GlobalAttentionPool(fgate) = GlobalAttentionPool(fgate, identity)

GNNLux/test/layers/pool.jl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,26 @@
33
@testset "Pooling" begin
44

55
rng = StableRNG(1234)
6-
g = rand_graph(rng, 10, 40)
7-
in_dims = 3
8-
x = randn(rng, Float32, in_dims, 10)
9-
106
@testset "GlobalPool" begin
7+
g = rand_graph(rng, 10, 40)
8+
in_dims = 3
9+
x = randn(rng, Float32, in_dims, 10)
1110
l = GlobalPool(mean)
1211
test_lux_layer(rng, l, g, x, sizey=(in_dims,1))
1312
end
1413
@testset "GlobalAttentionPool" begin
15-
fgate = Dense(in_dims, 1)
16-
ffeat = Dense(in_dims, in_dims)
14+
n = 10
15+
chin = 6
16+
chout = 5
17+
ng = 3
18+
g = batch([GNNGraph(rand_graph(rng, 10, 40),
19+
ndata = rand(Float32, chin, n)) for i in 1:ng])
20+
21+
fgate = Dense(chin, 1)
22+
ffeat = Dense(chin, chout)
1723
l = GlobalAttentionPool(fgate, ffeat)
18-
test_lux_layer(rng, l, g, x, sizey=(in_dims,1), container=true)
24+
25+
test_lux_layer(rng, l, g, g.ndata.x, sizey=(chout,ng), container=true)
1926
end
2027
end
2128
end

0 commit comments

Comments
 (0)