Skip to content

octree_blocks

Octree convolution and deconvolution blocks with normalization and activation.

Classes:

  • OctreeConvBlock –

    Octree convolution followed by normalization and activation.

  • OctreeDeconvBlock –

    Octree transposed convolution followed by normalization and activation.

OctreeConvBlock

OctreeConvBlock(
    in_channels: int,
    out_channels: int,
    kernel_size: Union[int, Sequence[int]],
    stride: int = 1,
    nempty: bool = False,
    act: Union[str, Callable, None] = "relu",
    act_kwargs: Optional[Dict[str, Any]] = None,
    act_first: bool = False,
    norm: Union[str, Callable, None] = "batch_norm",
    norm_kwargs: Optional[Dict[str, Any]] = None,
    bias: bool = True,
    method: str = "explicit_gemm",
    max_buffer: int = MAX_BUFFER,
)

Bases: Module

Octree convolution followed by normalization and activation.

Wraps ocnn.nn.OctreeConv with a norm / act pair built by create_norm / create_act. With act_first=True the activation runs before the normalization instead of after.

Parameters:

  • in_channels (int) –

    Number of input channels.

  • out_channels (int) –

    Number of output channels.

  • kernel_size (Union[int, Sequence[int]]) –

    Convolution kernel size (an int is broadcast to all axes).

  • stride (int, default: 1 ) –

    Convolution stride; 2 downsamples the octree by one depth level.

  • nempty (bool, default: False ) –

    Whether the features only cover non-empty octree nodes.

  • act (Union[str, Callable, None], default: 'relu' ) –

    Activation passed to create_act.

  • act_kwargs (Optional[Dict[str, Any]], default: None ) –

    Extra keyword arguments for the activation.

  • act_first (bool, default: False ) –

    Whether to apply the activation before the normalization.

  • norm (Union[str, Callable, None], default: 'batch_norm' ) –

    Normalization passed to create_norm.

  • norm_kwargs (Optional[Dict[str, Any]], default: None ) –

    Extra keyword arguments for the normalization.

  • bias (bool, default: True ) –

    Whether the convolution uses a bias.

  • method (str, default: 'explicit_gemm' ) –

    ocnn convolution implementation (e.g. "explicit_gemm").

  • max_buffer (int, default: MAX_BUFFER ) –

    Maximum buffer size (in elements) used by the ocnn convolution.

Shape
  • Input: \((M_\text{in}, C_\text{in})\) octree features at depth.
  • Output: \((M_\text{out}, C_\text{out})\) octree features (at depth - 1 when stride=2).

OctreeDeconvBlock

OctreeDeconvBlock(
    in_channels: int,
    out_channels: int,
    kernel_size: Union[int, Sequence[int]],
    stride: int = 1,
    nempty: bool = False,
    act: Union[str, Callable, None] = "relu",
    act_kwargs: Optional[Dict[str, Any]] = None,
    act_first: bool = False,
    norm: Union[str, Callable, None] = "batch_norm",
    norm_kwargs: Optional[Dict[str, Any]] = None,
    bias: bool = True,
    method: str = "explicit_gemm",
    max_buffer: int = MAX_BUFFER,
)

Bases: Module

Octree transposed convolution followed by normalization and activation.

Wraps ocnn.nn.OctreeDeconv with a norm / act pair built by create_norm / create_act. With act_first=True the activation runs before the normalization instead of after.

Parameters:

  • in_channels (int) –

    Number of input channels.

  • out_channels (int) –

    Number of output channels.

  • kernel_size (Union[int, Sequence[int]]) –

    Convolution kernel size (an int is broadcast to all axes).

  • stride (int, default: 1 ) –

    Convolution stride; 2 upsamples the octree by one depth level.

  • nempty (bool, default: False ) –

    Whether the features only cover non-empty octree nodes.

  • act (Union[str, Callable, None], default: 'relu' ) –

    Activation passed to create_act.

  • act_kwargs (Optional[Dict[str, Any]], default: None ) –

    Extra keyword arguments for the activation.

  • act_first (bool, default: False ) –

    Whether to apply the activation before the normalization.

  • norm (Union[str, Callable, None], default: 'batch_norm' ) –

    Normalization passed to create_norm.

  • norm_kwargs (Optional[Dict[str, Any]], default: None ) –

    Extra keyword arguments for the normalization.

  • bias (bool, default: True ) –

    Whether the convolution uses a bias.

  • method (str, default: 'explicit_gemm' ) –

    ocnn convolution implementation (e.g. "explicit_gemm").

  • max_buffer (int, default: MAX_BUFFER ) –

    Maximum buffer size (in elements) used by the ocnn convolution.

Shape
  • Input: \((M_\text{in}, C_\text{in})\) octree features at depth.
  • Output: \((M_\text{out}, C_\text{out})\) octree features (at depth + 1 when stride=2).