Skip to content

randlanet_blocks

RandLA-Net local feature aggregation: spatial encoding, attentive pooling, and the dilated residual block.

Classes:

LocalSpatialEncoding [source] ΒΆ

LocalSpatialEncoding(
    in_channels: int,
    out_channels: int,
    *,
    act: Union[str, Callable, None],
    act_kwargs: Optional[Dict[str, Any]] = None,
    act_first: bool = False,
    norm: Union[str, Callable, None],
    norm_kwargs: Optional[Dict[str, Any]] = None,
    bias: bool = False,
)

Bases: Module

Per-edge spatial encoding MLP.

Wraps a single Linear+norm+act block that lifts an input feature to out_channels. Used twice per LocalFeatureAggregation: first on the raw 10-channel relative positional encoding, then on its output.

AttentivePooling [source] ΒΆ

AttentivePooling(
    in_channels: int,
    out_channels: int,
    *,
    act: Union[str, Callable, None],
    act_kwargs: Optional[Dict[str, Any]] = None,
    act_first: bool = False,
    norm: Union[str, Callable, None],
    norm_kwargs: Optional[Dict[str, Any]] = None,
    bias: bool = False,
    **kwargs: Unpack[MessagePassingParams],
)

Bases: MessagePassing

Attention-weighted aggregation of neighbor features.

Each edge concatenates its source feature with a per-edge spatial encoding, scores the result with a no-bias linear layer, softmax-normalizes the scores over the neighbors of each target point, sums the score-weighted features per target, then projects them with a Linear+norm+act block.

edge_index lists [source, target] pairs and edge_attr holds the \((E, C_\text{pos})\) spatial encoding of each edge.

Parameters:

  • in_channels (int) –

    Channels of each edge feature, the source feature and the spatial encoding concatenated.

  • out_channels (int) –

    Output channels after the post-aggregation MLP.

  • **kwargs (Unpack[MessagePassingParams], default: {} ) –

    Extra arguments for MessagePassing.

LocalFeatureAggregation [source] ΒΆ

LocalFeatureAggregation(
    d_out: int,
    *,
    act: Union[str, Callable, None],
    act_kwargs: Optional[Dict[str, Any]] = None,
    act_first: bool = False,
    norm: Union[str, Callable, None],
    norm_kwargs: Optional[Dict[str, Any]] = None,
    bias: bool = False,
)

Bases: Module

Local feature aggregation: two rounds of spatial encoding and attentive pooling.

Each round grows the receptive field, taking a per-point feature of width \(d_\text{out} / 2\) to \(d_\text{out}\). The 10-channel relative positional encoding keeps the channel order of QingyongHu/RandLA-Net (cat([rel_dist, rel_xyz, xyz_i, xyz_j], dim=-1)) so pretrained weights load without permuting the first kernel, and the second encoding re-projects the output of the first.

RandLANetResidualBlock [source] ΒΆ

RandLANetResidualBlock(
    d_in: int,
    d_out: int,
    num_neighbors: int,
    *,
    act: Union[str, Callable, None],
    act_kwargs: Optional[Dict[str, Any]] = None,
    act_first: bool = False,
    norm: Union[str, Callable, None],
    norm_kwargs: Optional[Dict[str, Any]] = None,
    bias: bool = False,
)

Bases: Module

RandLA-Net dilated residual block.

Maps d_in channels to \(2 \cdot d_\text{out}\) via a residual path of MLP -> LocalFeatureAggregation -> MLP plus a parallel Linear+norm shortcut. mlp2 and shortcut carry no activation; the configured activation is applied once after the residual sum.

Parameters:

  • d_in (int) –

    Number of input channels.

  • d_out (int) –

    "Configuration" channel count; the block actually outputs \(2 \cdot d_\text{out}\).

  • num_neighbors (int) –

    Number of neighbors for the local feature aggregation.