Skip to content

Commit

Permalink
GConvGRU
Browse files Browse the repository at this point in the history
  • Loading branch information
CarloLucibello committed Dec 15, 2024
1 parent a6700c3 commit 43aedc2
Show file tree
Hide file tree
Showing 6 changed files with 752 additions and 550 deletions.
4 changes: 3 additions & 1 deletion GraphNeuralNetworks/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "1.0.0-DEV"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
GNNGraphs = "aed8fd31-079b-4b5a-b342-a13352159b8c"
GNNlib = "a6a84749-d869-43f8-aacc-be26a1996e48"
Expand All @@ -18,7 +19,8 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
ChainRulesCore = "1"
Flux = "0.15"
ConcreteStructs = "0.2.3"
Flux = "0.16.0"
GNNGraphs = "1.4"
GNNlib = "1"
LinearAlgebra = "1"
Expand Down
7 changes: 4 additions & 3 deletions GraphNeuralNetworks/src/GraphNeuralNetworks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ module GraphNeuralNetworks
using Statistics: mean
using LinearAlgebra, Random
using Flux
using Flux: glorot_uniform, leakyrelu, GRUCell, batch
using Flux: glorot_uniform, leakyrelu, GRUCell, batch, initialstates
using MacroTools: @forward
using NNlib
using ChainRulesCore
using Reexport: @reexport
using MLUtils: zeros_like
using ConcreteStructs: @concrete

using GNNGraphs: COO_T, ADJMAT_T, SPARSE_T,
check_num_nodes, check_num_edges,
Expand Down Expand Up @@ -49,10 +50,10 @@ include("layers/heteroconv.jl")
export HeteroGraphConv

include("layers/temporalconv.jl")
export TGCN,
export GConvGRU, GConvGRUCell,
TGCN,
A3TGCN,
GConvLSTM,
GConvGRU,
DCGRU,
EvolveGCNO

Expand Down
6 changes: 6 additions & 0 deletions GraphNeuralNetworks/src/layers/conv.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# The implementations of the forward pass of the graph convolutional layers are in the `GNNlib` module,
# in the src/layers/conv.jl file. The `GNNlib` module is re-exported in the GraphNeuralNetworks module.
# This annoying for the readability of the code, as the user has to look at two different files to understand
# the implementation of a single layer,
# but it is done for GraphNeuralNetworks.jl and GNNLux.jl to be able to share the same code.

@doc raw"""
GCNConv(in => out, σ=identity; [bias, init, add_self_loops, use_edge_weight])
Expand Down
6 changes: 0 additions & 6 deletions GraphNeuralNetworks/src/layers/pool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,6 @@ function Set2Set(n_in::Int, n_iters::Int, n_layers::Int = 1)
return Set2Set(lstm, n_iters)
end

function initialstates(cell::LSTMCell)
h = zeros_like(cell.Wh, size(cell.Wh, 2))
c = zeros_like(cell.Wh, size(cell.Wh, 2))
return h, c
end

function (l::Set2Set)(g, x)
return GNNlib.set2set_pool(l, g, x)
end
Expand Down
Loading

0 comments on commit 43aedc2

Please sign in to comment.