You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Takes as input a graph `g`, a node feature matrix `x` of size `[in, num_nodes]`, optionally an edge weight vector and the parameter and state of the layer. Returns a node feature matrix of size
43
+
`[out, num_nodes]`.
44
+
45
+
The `norm_fn` parameter allows for custom normalization of the graph convolution operation by passing a function as argument.
46
+
By default, it computes ``\frac{1}{\sqrt{d}}`` i.e the inverse square root of the degree (`d`) of each node in the graph.
47
+
If `conv_weight` is an `AbstractMatrix` of size `[out, in]`, then the convolution is performed using that weight matrix.
48
+
49
+
# Examples
50
+
51
+
```julia
52
+
using GNNLux, Lux, Random
53
+
# initialize random number generator
54
+
rng = Random.default_rng()
55
+
Random.seed!(rng, 0)
56
+
# create data
57
+
s = [1,1,2,3]
58
+
t = [2,3,1,1]
59
+
g = GNNGraph(s, t)
60
+
x = randn(Float32, 3, g.num_nodes)
61
+
62
+
# create layer
63
+
l = GCNConv(3 => 5)
64
+
65
+
# setup layer
66
+
ps, st = LuxCore.setup(rng, l)
67
+
68
+
# forward pass
69
+
y = l(g, x, ps, st) # size of the output first entry: 5 × num_nodes
70
+
71
+
# convolution with edge weights and custom normalization function
0 commit comments