Skip to content

Commit 1fb54b6

Browse files
Added TransformerConv usage example (#422)
* transformerconv usage example * fix * Update src/layers/conv.jl Co-authored-by: Carlo Lucibello <[email protected]> --------- Co-authored-by: Carlo Lucibello <[email protected]>
1 parent c965820 commit 1fb54b6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/layers/conv.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,6 +1790,18 @@ can be performed.
17901790
- `ff_channels`: If positive, a feed-forward NN is appended, with the first having the given
17911791
number of hidden nodes; this NN also gets a skip connection and batch normalization
17921792
if the respective parameters are set. Default: `0`.
1793+
1794+
# Examples
1795+
1796+
```julia
1797+
N, in_channel, out_channel = 4, 3, 5
1798+
ein, heads = 2, 3
1799+
g = GNNGraph([1,1,2,4], [2,3,1,1])
1800+
l = TransformerConv((in_channel, ein) => in_channel; heads, gating = true, bias_qkv = true)
1801+
x = rand(Float32, in_channel, N)
1802+
e = rand(Float32, ein, g.num_edges)
1803+
l(g, x, e)
1804+
```
17931805
"""
17941806
struct TransformerConv{TW1, TW2, TW3, TW4, TW5, TW6, TFF, TBN1, TBN2} <: GNNLayer
17951807
W1::TW1

0 commit comments

Comments
 (0)