Skip to content

Commit 8b30efd

Browse files
committed
Add DConv docstring
1 parent 9944798 commit 8b30efd

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

GNNLux/src/layers/conv.jl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,40 @@ function Base.show(io::IO, l::EGNNConv)
710710
print(io, ")")
711711
end
712712

713+
"""
714+
DConv(in => out, k; init_weight = glorot_uniform, init_bias = zeros32, use_bias = true)
715+
716+
Diffusion convolution layer from the paper [Diffusion Convolutional Recurrent Neural Networks: Data-Driven Traffic Forecasting](https://arxiv.org/pdf/1707.01926).
717+
718+
# Arguments
719+
720+
- `in`: The dimension of input features.
721+
- `out`: The dimension of output features.
722+
- `k`: Number of diffusion steps.
723+
- `init_weight`: Weights' initializer. Default `glorot_uniform`.
724+
- `init_bias`: Bias initializer. Default `zeros32`.
725+
- `use_bias`: Add learnable bias. Default `true`.
726+
727+
728+
# Examples
729+
```julia
730+
using GNNLux, Lux, Random
731+
732+
# initialize random number generator
733+
rng = Random.default_rng()
734+
735+
# create random graph
736+
g = GNNGraph(rand(rng, 10, 10), ndata = rand(rng, Float32, 2, 10))
737+
738+
dconv = DConv(2 => 4, 4)
739+
740+
# setup layer
741+
ps, st = LuxCore.setup(rng, dconv)
742+
743+
# forward pass
744+
y, st = dconv(g, g.ndata.x, ps, st) # size: (4, num_nodes)
745+
```
746+
"""
713747
@concrete struct DConv <: GNNLayer
714748
in_dims::Int
715749
out_dims::Int

0 commit comments

Comments
 (0)