XConv
¶
XConv(
node_features_dim: int,
out_features_dim: int,
dim: int,
kernel_size: int,
hidden_features_dim: Optional[int] = None,
dilation: int = 1,
bias: bool = True,
)
Bases: Module
The convolutional operator on \(\mathcal{X}\)-transformed points from the "PointCNN: Convolution On X-Transformed Points" paper.
where \(\mathbf{K}\) and \(\mathbf{P}_i\) denote the trainable
filter and the neighboring point positions of \(\mathbf{x}_i\), and
\(\gamma_{\mathbf{\Theta}}\) and \(h_{\mathbf{\Theta}}\) are
neural networks. The neighbors are the kernel_size * dilation nearest
points (including the point itself), of which every dilation-th one is
kept, as in PyG.
Each graph must have at least kernel_size * dilation points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_features_dim
|
int
|
Size of the input features ( |
required |
out_features_dim
|
int
|
Size of the output features. |
required |
dim
|
int
|
Point cloud dimensionality. |
required |
kernel_size
|
int
|
Size of the convolving kernel, i.e. the number of neighbors. |
required |
hidden_features_dim
|
Optional[int]
|
Size of the lifted point positions. Default:
|
None
|
dilation
|
int
|
The factor by which the neighborhood is extended. Default:
|
1
|
bias
|
bool
|
Whether the final linear layer has a bias. Default: |
True
|
Example:
import mlx.core as mx
from mlx_graphs.nn import XConv
pos = mx.random.normal((100, 3))
x = mx.random.normal((100, 16))
conv = XConv(16, 32, dim=3, kernel_size=8)
>>> conv(x, pos).shape
(100, 32)
Methods:
| Name | Description |
|---|---|
__call__ |
Computes the forward pass of XConv. |
Source code in mlx_graphs/nn/conv/x_conv.py
__call__
¶
__call__(
node_features: Optional[array],
pos: array,
batch_indices: Optional[array] = None,
) -> array
Computes the forward pass of XConv.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_features
|
Optional[array]
|
Point features of shape |
required |
pos
|
array
|
Point positions of shape |
required |
batch_indices
|
Optional[array]
|
Graph of each point, of shape |
None
|
Returns:
| Type | Description |
|---|---|
array
|
The features of the points, of shape |
Source code in mlx_graphs/nn/conv/x_conv.py
from mlx_graphs.nn import XConv · mlx_graphs/nn/conv/x_conv.py