Hey ! I am trying to reproduce this python code in julia : (Supervised graph classification with Deep Graph CNN — StellarGraph 1.2.1 documentation).

While the GNN part is completely fine, I am finding myself to struggle with the implementation of a 1D Convolutional layer, and in general the CNN part.

So far my model is designed as follow:

model = GNNChain(GCNConv(4 => 32,tanh),

GCNConv(32 => 32,tanh),

GCNConv(32 => 32,tanh),

GCNConv(32 => 1,tanh),

GlobalPool(mean),

Flux.Conv((97,1),1=>16,relu,stride=97),

Flux.MaxPool((1,97),pad=2),

Flux.Conv((1,5),16=>32,relu,stride=1),

Dense(32=>1,relu)) |> device

While debugging and implementing

model[1:6]

the 6th layer

Flux.Conv((97,1),1=>16,relu,stride=97))

breaks and returns to me the error:

DimensionMismatch(“Rank of x and w must match! (2 vs. 4)”)

From what I understand and read online, ( Flux: 1D convolutions (on genomic data) - Specific Domains / Machine Learning - Julia Programming Language (julialang.org)) the dimension of the Conv layer expect 3 or 4d data however the dimension of the previous layer in my code is (1,30), therefore I believe this is where the mismatch comes from. However, I do not know what to do from here…

Here is a MWE data that you can use to pass through the model:

using GraphNeuralNetworks

using Flux

g = rand_graph(22080,175800)

graph = GNNGraph(g,ndata=rand(4,g.num_nodes))

model[1:6] (g,g.ndata.x)

Thanks for your help,

Your boi