LEConv
¶
LEConv(
node_features_dim: Union[int, Tuple[int, int]],
out_features_dim: int,
bias: bool = True,
**kwargs,
)
Bases: MessagePassing
Local extremum graph convolution layer from the "ASAP: Adaptive Structure Aware Pooling for Learning Hierarchical Graph Representations" paper.
where \(e_{j,i}\) is the weight of the edge from node \(j\) to node
\(i\) (1 if no weights are given). \(\mathbf{\Theta}_1\),
\(\mathbf{\Theta}_2\) and \(\mathbf{\Theta}_3\) are the lin1,
lin2 and lin3 projections (lin2 has no bias).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_features_dim
|
Union[int, Tuple[int, int]]
|
Size of input node features, or a |
required |
out_features_dim
|
int
|
Size of output node embeddings |
required |
bias
|
bool
|
Whether to use biases in the projections. Default: |
True
|
**kwargs
|
Arguments of |
{}
|
Example:
import mlx.core as mx
from mlx_graphs.nn import LEConv
edge_index = mx.array([[0, 1, 2, 3, 4], [1, 0, 3, 2, 0]])
node_features = mx.random.normal((5, 16))
conv = LEConv(16, 32)
h = conv(edge_index, node_features)
>>> h.shape
(5, 32)
References
Methods:
| Name | Description |
|---|---|
__call__ |
Computes the forward pass of LEConv. |
Source code in mlx_graphs/nn/conv/le_conv.py
__call__
¶
__call__(
edge_index: array,
node_features: Union[array, Tuple[array, array]],
edge_weights: Optional[array] = None,
) -> array
Computes the forward pass of LEConv.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_index
|
array
|
Input edge index of shape |
required |
node_features
|
Union[array, Tuple[array, array]]
|
Input node features, or a |
required |
edge_weights
|
Optional[array]
|
Optional scalar weight per edge, of shape |
None
|
Returns:
| Type | Description |
|---|---|
array
|
The computed node embeddings, one row per destination node |
Source code in mlx_graphs/nn/conv/le_conv.py
from mlx_graphs.nn import LEConv · mlx_graphs/nn/conv/le_conv.py