Skip to content
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/layers/pool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,25 @@ end

(l::GlobalPool)(g::GNNGraph) = GNNGraph(g, gdata=l(g, node_features(g)))

@doc raw"""
GlobalConcatPool(aggr)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a docstring

```math
\mathbf{x}_i' = [\mathbf{x}_i; \square_{i \in V} \mathbf{x}_i]

"""
struct GlobalConcatPool{F} <: GNNLayer
aggr::F
end

function (l::GlobalConcatPool)(g::GNNGraph, x::AbstractArray)
g_feat = reduce_nodes(l.aggr, g, x)
feat_arr = broadcast_nodes(g, g_feat)
return vcat(x, feat_arr)
end

(l::GlobalConcatPool)(g::GNNGraph) = GNNGraph(g, gdata=l(g, node_features(g)))


@doc raw"""
GlobalAttentionPool(fgate, ffeat=identity)
Expand Down