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:
- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- 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:
_BaseConv3dSupport-generating sparse 3D convolution.
- class torch_lattice.nn.ConvTranspose3d(in_channels, out_channels, kernel_size=3, stride=1, padding=0, dilation=1, bias=False, config=None)[source]¶
Bases:
_BaseConv3dSparse transposed 3D convolution using an existing inverse support map.
- class torch_lattice.nn.GenerativeConvTranspose3d(in_channels, out_channels, kernel_size=3, stride=1, padding=0, dilation=1, bias=False, config=None)[source]¶
Bases:
_BaseConv3dSparse transposed 3D convolution that generates its output support.
- class torch_lattice.nn.GlobalAvgPool(*args, **kwargs)[source]¶
Bases:
Module- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- Parameters:
input (SparseTensor)
batch_size (int | None)
- class torch_lattice.nn.GlobalMaxPool(*args, **kwargs)[source]¶
Bases:
Module- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- Parameters:
input (SparseTensor)
batch_size (int | None)
- class torch_lattice.nn.GlobalSumPool(*args, **kwargs)[source]¶
Bases:
Module- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- Parameters:
input (SparseTensor)
batch_size (int | None)
- class torch_lattice.nn.GroupNorm(num_groups, num_channels, eps=1e-05, affine=True, device=None, dtype=None)[source]¶
Bases:
GroupNorm- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- 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- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- Parameters:
input (SparseTensor)
- class torch_lattice.nn.LeakyReLU(negative_slope=0.01, inplace=False)[source]¶
Bases:
LeakyReLU- forward(input)[source]¶
Run forward pass.
- Return type:
- 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:
ConvTranspose3dWeight-normalized sparse transpose convolution.
- 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:
GenerativeConvTranspose3dWeight-normalized transpose convolution with generated support.
- class torch_lattice.nn.NormalizedSubmConv3d(in_channels, out_channels, kernel_size=3, dilation=1, bias=False, eps=1e-08, config=None)[source]¶
Bases:
SubmConv3dWeight-normalized convolution on input coordinate support.
- class torch_lattice.nn.Pool3d(*, mode, kernel_size=2, stride=2, padding=0, dilation=1)[source]¶
Bases:
ModuleLocal 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- Parameters:
input (SparseTensor)
- class torch_lattice.nn.PoolTranspose3d(kernel_size=2, stride=2, padding=0, dilation=1)[source]¶
Bases:
ModuleAverage-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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- Parameters:
input (SparseTensor)
coordinates (SparseTensor | None)
- class torch_lattice.nn.RMSNorm(normalized_shape, eps=1e-06, elementwise_affine=True, device=None, dtype=None)[source]¶
Bases:
Module- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- 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:
- 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:
- Parameters:
input (SparseTensor)
- class torch_lattice.nn.Sigmoid(*args, **kwargs)[source]¶
Bases:
Sigmoid- forward(input)[source]¶
Runs the forward pass.
- Return type:
- Parameters:
input (SparseTensor)
- class torch_lattice.nn.Softplus(beta=1.0, threshold=20.0)[source]¶
Bases:
Softplus- forward(input)[source]¶
Run forward pass.
- Return type:
- Parameters:
input (SparseTensor)
- class torch_lattice.nn.SparseCrop(coords_min=None, coords_max=None)[source]¶
Bases:
Module- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- Parameters:
input (SparseTensor)
- class torch_lattice.nn.SubmConv3d(in_channels, out_channels, kernel_size=3, dilation=1, bias=False, config=None)[source]¶
Bases:
_BaseConv3dSupport-preserving submanifold sparse 3D convolution.
- 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- forward(input)[source]¶
Runs the forward pass.
- Return type:
- Parameters:
input (SparseTensor)
- class torch_lattice.nn.ToBEVConvolution(in_channels, out_channels, n_kernels, stride=1, dim=3, bias=False)[source]¶
Bases:
ModuleConverts a SparseTensor into a sparse BEV feature map.
- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- Parameters:
input (SparseTensor)
- class torch_lattice.nn.ToBEVHeightCompression(channels, shape, offset=(0, 0, 0), dim=3)[source]¶
Bases:
ModuleConverts a SparseTensor to a flattened volumetric tensor.
- Parameters:
- 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:
- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- Parameters:
input (SparseTensor)
- class torch_lattice.nn.ToDenseBEVConvolution(in_channels, out_channels, shape, offset=(0, 0, 0), dim=3, bias=False)[source]¶
Bases:
ModuleConverts 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 channelsout_channels (
int) – Number of output channelsshape (
List[int] |Tuple[int,int,int] |Tensor) – Shape of BEV mapdim (
int) – Coordinate dimension index for z. Coordinates are ordered (batch, x, y, z), so the default is 3.bias (
bool) – Whether to use bias
- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- Parameters:
input (SparseTensor)
- class torch_lattice.nn.TrilinearUpsample3d(stride=2)[source]¶
Bases:
ModuleNormalized 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
- Parameters:
input (SparseTensor)
coordinates (SparseTensor | None)