minuet.tensors#

Classes

SparseTensor(features, coordinates, *[, ...])

SparseTensor stores coordinates along with its features.

class SparseTensor(features: Tensor, coordinates: Tensor, *, stride: int | Tuple[int, ...] = 1, batch_dims: Tensor | None = None)#

SparseTensor stores coordinates along with its features. There are several constraints of the coordinates for the sparse tensor:

  • The coordinates tensor should only have \(2\) dimensions of shape \((N, D)\). Where \(N\) denotes the number of points and \(D\) denotes the number of dimensions (typically it is just \(3\)).

  • All coordinates should be all integers. Specifically, their data types should be either torch.int32 or torch.int64.

  • All coordinates should be unique and sorted.

  • The number of features should match the number of coordinates.

  • Both features and coordinates should be on the same device.

Note that a SparseTensor can store multiple point clouds. This is achieved by the batch_dims tensor, where the indices of the points and the features of the \(i\)-th point cloud are within the interval \([\text{batch_dims}[i], \text{batch_dims}[i + 1])\).

Parameters:
  • features – the tensor that stores all features of the point clouds

  • coordinates – the coordinate that stores all coordinates of the point clouds

  • stride – the stride of the tensor

  • batch_dims – None the indices of each point cloud

property C#

The coordinate tensor of the current SparseTensor

property F#

The feature tensor of the current SparseTensor

backward(**kwargs)#

Similar to applying torch.Tensor.backward() on the feature tensor

property batch_dims#

The batch dims of the current SparseTensor

property batch_size#

The number of the point clouds of the current SparseTensor

clone()#

To clone the current SparseTensor

Returns:

A cloned SparseTensor

contiguous()#

Similar to applying torch.Tensor.contiguous() on both the coordinate and the feature tensors

cpu()#

Similar to applying torch.Tensor.cpu() on both the coordinate and the feature tensors

cuda(device: device | None = None, non_blocking: bool = False)#

Similar to applying torch.Tensor.cuda() on both the coordinate and the feature tensors

detach()#

Similar to applying torch.Tensor.detach() on the feature tensor

detach_()#

Similar to applying torch.Tensor.detach_() on the feature tensor

property device#

Similar to torch.Tensor.device()

property dtype#

The data type of the feature tensor of the current SparseTensor

half()#

Similar to applying torch.Tensor.half() on the feature tensor

property n#

The number of coordinates of all point clouds in the current SparseTensor

property ndim#

The number of dimensions of the coordinates of the current SparseTensor

property num_features#

The number of the feature channels of the feature tensor of the current SparseTensor

property requires_grad#

Similar to applying torch.Tensor.requires_grad on the feature tensor

property shape#

The shape of the feature tensor of the current SparseTensor

property stride#

The stride of the current SparseTensor

to(device: device | None = None, dtype: dtype | None = None, non_blocking: bool = False, copy: bool = False)#

Similar to applying torch.Tensor.cuda() on both the coordinate and the feature tensors. The only catch is that dtype parameter only applies to the feature tensor.