NN top-level exports

class torch_lattice.nn.GELU(approximate='none')[source]

Bases: GELU

Parameters:

approximate (str)

forward(input)[source]

Runs the forward pass.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.AvgPool3d(kernel_size=2, stride=2, padding=0, dilation=1)[source]

Bases: Pool3d

class torch_lattice.nn.BatchNorm(num_features, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True, device=None, dtype=None)[source]

Bases: BatchNorm1d

Parameters:
forward(input)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.Conv3d(in_channels, out_channels, kernel_size=3, stride=1, padding=0, dilation=1, bias=False, config=None)[source]

Bases: _BaseConv3d

Support-generating sparse 3D convolution.

Parameters:
  • in_channels (int)

  • out_channels (int)

  • kernel_size (int | Sequence[int])

  • stride (int | Sequence[int])

  • padding (int | Sequence[int])

  • dilation (int | Sequence[int])

  • bias (bool)

  • config (Mapping | None)

class torch_lattice.nn.ConvTranspose3d(in_channels, out_channels, kernel_size=3, stride=1, padding=0, dilation=1, bias=False, config=None)[source]

Bases: _BaseConv3d

Sparse transposed 3D convolution using an existing inverse support map.

Parameters:
  • in_channels (int)

  • out_channels (int)

  • kernel_size (int | Sequence[int])

  • stride (int | Sequence[int])

  • padding (int | Sequence[int])

  • dilation (int | Sequence[int])

  • bias (bool)

  • config (Mapping | None)

class torch_lattice.nn.GenerativeConvTranspose3d(in_channels, out_channels, kernel_size=3, stride=1, padding=0, dilation=1, bias=False, config=None)[source]

Bases: _BaseConv3d

Sparse transposed 3D convolution that generates its output support.

Parameters:
  • in_channels (int)

  • out_channels (int)

  • kernel_size (int | Sequence[int])

  • stride (int | Sequence[int])

  • padding (int | Sequence[int])

  • dilation (int | Sequence[int])

  • bias (bool)

  • config (Mapping | None)

class torch_lattice.nn.GlobalAvgPool(*args, **kwargs)[source]

Bases: Module

Parameters:
forward(input, *, batch_size=None)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

Tensor

Parameters:
class torch_lattice.nn.GlobalMaxPool(*args, **kwargs)[source]

Bases: Module

Parameters:
forward(input, *, batch_size=None)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

Tensor

Parameters:
class torch_lattice.nn.GlobalSumPool(*args, **kwargs)[source]

Bases: Module

Parameters:
forward(input, *, batch_size=None)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

Tensor

Parameters:
class torch_lattice.nn.GroupNorm(num_groups, num_channels, eps=1e-05, affine=True, device=None, dtype=None)[source]

Bases: GroupNorm

Parameters:
forward(input)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.InstanceNorm(num_features, eps=1e-05, momentum=0.1, affine=False, track_running_stats=False, device=None, dtype=None)[source]

Bases: InstanceNorm1d

Parameters:
forward(input)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.LayerNorm(normalized_shape, eps=1e-05, elementwise_affine=True, bias=True, device=None, dtype=None)[source]

Bases: LayerNorm

Parameters:
forward(input)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.LeakyReLU(negative_slope=0.01, inplace=False)[source]

Bases: LeakyReLU

Parameters:
forward(input)[source]

Run forward pass.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.MaxPool3d(kernel_size=2, stride=2, padding=0, dilation=1)[source]

Bases: Pool3d

class torch_lattice.nn.NormalizedConvTranspose3d(in_channels, out_channels, kernel_size=3, stride=1, padding=0, dilation=1, bias=False, eps=1e-08, config=None)[source]

Bases: ConvTranspose3d

Weight-normalized sparse transpose convolution.

Parameters:
  • in_channels (int)

  • out_channels (int)

  • kernel_size (int | Sequence[int])

  • stride (int | Sequence[int])

  • padding (int | Sequence[int])

  • dilation (int | Sequence[int])

  • bias (bool)

  • eps (float)

  • config (Mapping | None)

class torch_lattice.nn.NormalizedGenerativeConvTranspose3d(in_channels, out_channels, kernel_size=3, stride=1, padding=0, dilation=1, bias=False, eps=1e-08, config=None)[source]

Bases: GenerativeConvTranspose3d

Weight-normalized transpose convolution with generated support.

Parameters:
  • in_channels (int)

  • out_channels (int)

  • kernel_size (int | Sequence[int])

  • stride (int | Sequence[int])

  • padding (int | Sequence[int])

  • dilation (int | Sequence[int])

  • bias (bool)

  • eps (float)

  • config (Mapping | None)

class torch_lattice.nn.NormalizedSubmConv3d(in_channels, out_channels, kernel_size=3, dilation=1, bias=False, eps=1e-08, config=None)[source]

Bases: SubmConv3d

Weight-normalized convolution on input coordinate support.

Parameters:
  • in_channels (int)

  • out_channels (int)

  • kernel_size (int | Sequence[int])

  • dilation (int | Sequence[int])

  • bias (bool)

  • eps (float)

  • config (Mapping | None)

class torch_lattice.nn.Pool3d(*, mode, kernel_size=2, stride=2, padding=0, dilation=1)[source]

Bases: Module

Local sparse 3D pooling over generated output support.

Parameters:

mode (Literal['sum', 'max', 'avg'])

forward(input)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.PoolTranspose3d(kernel_size=2, stride=2, padding=0, dilation=1)[source]

Bases: Module

Average-pooling transpose onto generated or explicit target support.

forward(input, coordinates=None)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

SparseTensor

Parameters:
class torch_lattice.nn.RMSNorm(normalized_shape, eps=1e-06, elementwise_affine=True, device=None, dtype=None)[source]

Bases: Module

Parameters:
forward(input)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.ReLU(inplace=False)[source]

Bases: ReLU

Parameters:

inplace (bool)

forward(input)[source]

Runs the forward pass.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.SiLU(inplace=False)[source]

Bases: SiLU

Parameters:

inplace (bool)

forward(input)[source]

Runs the forward pass.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.Sigmoid(*args, **kwargs)[source]

Bases: Sigmoid

Parameters:
forward(input)[source]

Runs the forward pass.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.Softplus(beta=1.0, threshold=20.0)[source]

Bases: Softplus

Parameters:
forward(input)[source]

Run forward pass.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.SparseCrop(coords_min=None, coords_max=None)[source]

Bases: Module

Parameters:
forward(input)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.SubmConv3d(in_channels, out_channels, kernel_size=3, dilation=1, bias=False, config=None)[source]

Bases: _BaseConv3d

Support-preserving submanifold sparse 3D convolution.

Parameters:
  • in_channels (int)

  • out_channels (int)

  • kernel_size (int | Sequence[int])

  • dilation (int | Sequence[int])

  • bias (bool)

  • config (Mapping | None)

class torch_lattice.nn.SumPool3d(kernel_size=2, stride=2, padding=0, dilation=1)[source]

Bases: Pool3d

class torch_lattice.nn.Tanh(*args, **kwargs)[source]

Bases: Tanh

Parameters:
forward(input)[source]

Runs the forward pass.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.ToBEVConvolution(in_channels, out_channels, n_kernels, stride=1, dim=3, bias=False)[source]

Bases: Module

Converts a SparseTensor into a sparse BEV feature map.

Parameters:
reset_parameters()[source]
extra_repr()[source]

Return the extra representation of the module.

To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.

forward(input)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

Tensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.ToBEVHeightCompression(channels, shape, offset=(0, 0, 0), dim=3)[source]

Bases: Module

Converts a SparseTensor to a flattened volumetric tensor.

Parameters:
  • channels (int) – Number of input channels

  • (Note – output channels = channels x #unique z values)

  • shape (List[int] | Tuple[int, int, int] | Tensor) – Shape of BEV map

  • dim (int) – Coordinate dimension index for z. Coordinates are ordered (batch, x, y, z), so the default is 3.

  • offset (Tuple[int, int, int])

extra_repr()[source]

Return the extra representation of the module.

To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.

Return type:

str

forward(input)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

Tensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.ToBEVReduction(dim=3)[source]

Bases: Module

Parameters:

dim (int)

extra_repr()[source]

Return the extra representation of the module.

To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.

forward(input)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

SparseTensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.ToDenseBEVConvolution(in_channels, out_channels, shape, offset=(0, 0, 0), dim=3, bias=False)[source]

Bases: Module

Converts a SparseTensor into a dense BEV feature map.

Group points with the same z value together and apply the same FC kernel. Aggregate the results by summing up all features within one BEV grid. .. note:: This module consumes larger memory than ToBEVHeightCompression.

Parameters:
  • in_channels (int) – Number of input channels

  • out_channels (int) – Number of output channels

  • shape (List[int] | Tuple[int, int, int] | Tensor) – Shape of BEV map

  • dim (int) – Coordinate dimension index for z. Coordinates are ordered (batch, x, y, z), so the default is 3.

  • bias (bool) – Whether to use bias

  • offset (Tuple[int, int, int])

extra_repr()[source]

Return the extra representation of the module.

To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.

reset_parameters()[source]
forward(input)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

Tensor

Parameters:

input (SparseTensor)

class torch_lattice.nn.TrilinearUpsample3d(stride=2)[source]

Bases: Module

Normalized trilinear upsampling on generated or target support.

forward(input, coordinates=None)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

SparseTensor

Parameters: