PointTransformerConv
¶
PointTransformerConv(
node_features_dim: Union[int, Tuple[int, int]],
out_features_dim: int,
pos_nn: Optional[Callable] = None,
attn_nn: Optional[Callable] = None,
add_self_loops: bool = True,
**kwargs,
)
Bases: MessagePassing
The Point Transformer layer from the "Point Transformer" paper.
where the attention coefficients \(\alpha_{i,j}\) and the positional embedding \(\delta_{ij}\) are
The softmax is taken over the neighbors of each node, separately for each
channel. \(\gamma_\mathbf{\Theta}\) (attn_nn) and
\(h_\mathbf{\Theta}\) (pos_nn) are neural networks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_features_dim
|
Union[int, Tuple[int, int]]
|
Size of the input features, or a |
required |
out_features_dim
|
int
|
Size of the output features. |
required |
pos_nn
|
Optional[Callable]
|
Network \(h_\mathbf{\Theta}\) mapping the relative
positions of shape |
None
|
attn_nn
|
Optional[Callable]
|
Network \(\gamma_\mathbf{\Theta}\) mapping attention
logits of shape |
None
|
add_self_loops
|
bool
|
If |
True
|
**kwargs
|
Arguments of |
{}
|
Example:
import mlx.core as mx
from mlx_graphs.nn import PointTransformerConv
from mlx_graphs.utils import knn_graph
pos = mx.random.normal((100, 3))
x = mx.random.normal((100, 16))
conv = PointTransformerConv(16, 32)
>>> conv(knn_graph(pos, k=8), x, pos).shape
(100, 32)
Methods:
| Name | Description |
|---|---|
__call__ |
Computes the forward pass of PointTransformerConv. |
Source code in mlx_graphs/nn/conv/point_transformer_conv.py
__call__
¶
Computes the forward pass of PointTransformerConv.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_index
|
array
|
Edges of shape |
required |
node_features
|
Pair
|
Features of the points, or a |
required |
pos
|
Pair
|
Positions of the points, of shape |
required |
Returns:
| Type | Description |
|---|---|
array
|
The features of the destination points. |
Source code in mlx_graphs/nn/conv/point_transformer_conv.py
from mlx_graphs.nn import PointTransformerConv · mlx_graphs/nn/conv/point_transformer_conv.py