Utility Functions
Index
GNNlib.broadcast_edges
GNNlib.broadcast_nodes
GNNlib.reduce_edges
GNNlib.reduce_nodes
GNNlib.softmax_edge_neighbors
GNNlib.softmax_edges
GNNlib.softmax_nodes
Docs
Graph-wise operations
GNNlib.reduce_nodes
— Functionreduce_nodes(aggr, g, x)
For a batched graph g
, return the graph-wise aggregation of the node features x
. The aggregation operator aggr
can be +
, mean
, max
, or min
. The returned array will have last dimension g.num_graphs
.
See also: reduce_edges
.
reduce_nodes(aggr, indicator::AbstractVector, x)
Return the graph-wise aggregation of the node features x
given the graph indicator indicator
. The aggregation operator aggr
can be +
, mean
, max
, or min
.
See also graph_indicator
.
GNNlib.reduce_edges
— Functionreduce_edges(aggr, g, e)
For a batched graph g
, return the graph-wise aggregation of the edge features e
. The aggregation operator aggr
can be +
, mean
, max
, or min
. The returned array will have last dimension g.num_graphs
.
GNNlib.softmax_nodes
— Functionsoftmax_nodes(g, x)
Graph-wise softmax of the node features x
.
GNNlib.softmax_edges
— Functionsoftmax_edges(g, e)
Graph-wise softmax of the edge features e
.
GNNlib.broadcast_nodes
— Functionbroadcast_nodes(g, x)
Graph-wise broadcast array x
of size (*, g.num_graphs)
to size (*, g.num_nodes)
.
GNNlib.broadcast_edges
— Functionbroadcast_edges(g, x)
Graph-wise broadcast array x
of size (*, g.num_graphs)
to size (*, g.num_edges)
.
Neighborhood operations
GNNlib.softmax_edge_neighbors
— Functionsoftmax_edge_neighbors(g, e)
Softmax over each node's neighborhood of the edge features e
.
\[\mathbf{e}'_{j\to i} = \frac{e^{\mathbf{e}_{j\to i}}} {\sum_{j'\in N(i)} e^{\mathbf{e}_{j'\to i}}}.\]
NNlib
Primitive functions implemented in NNlib.jl: