Skip to content

torchsparse_blocks

torchsparse convolution blocks: a conv + norm + act block and a residual block over SparseTensors.

Classes:

TorchSparseConvBlock [source] ¶

TorchSparseConvBlock(
    in_channels: int,
    out_channels: int,
    kernel_size: int = 3,
    stride: int = 1,
    dilation: int = 1,
    transposed: bool = False,
    act: Union[str, Callable, None] = "relu",
    act_kwargs: Optional[Dict[str, Any]] = None,
    norm: Union[str, Callable, None] = "batch_norm",
    norm_kwargs: Optional[Dict[str, Any]] = None,
)

Bases: Module

Sparse 3D convolution followed by normalization and activation.

Set transposed=True for an upsampling (inverse) convolution.

TorchSparseResidualBlock [source] ¶

TorchSparseResidualBlock(
    in_channels: int,
    out_channels: int,
    kernel_size: int = 3,
    stride: int = 1,
    dilation: int = 1,
    drop_path: float = 0.0,
    act: Union[str, Callable, None] = "relu",
    act_kwargs: Optional[Dict[str, Any]] = None,
    norm: Union[str, Callable, None] = "batch_norm",
    norm_kwargs: Optional[Dict[str, Any]] = None,
)

Bases: Module

Residual block of two sparse 3D convolutions.

A pointwise convolution projects the skip connection when the channel count or stride changes.