Sparse tensor¶
Batch views are derived from the coordinate batch column, while declared
batch_counts or spatial_range preserve empty batches. The decomposed
coordinate views omit the batch column and remain available after row-changing
layers.
- class torch_lattice.tensor.SparseTensor(feats, coords, stride=1, spatial_range=None, *, batch_counts=None, coord_manager=None, coord_key=None)[source]¶
Bases:
objectSparse feature value with explicit coordinate-support identity.
Coordinates have shape
(N, 4)and use(batch, x, y, z)order. Features have shape(N, C)and share their row order with coordinates. Coordinate managers own support identity and cached sparse relations; feature-only transformations preserve that identity, while row-changing operations create a new coordinate key.- Parameters:
feats (torch.Tensor)
coords (torch.Tensor)
batch_counts (Sequence[int] | None)
coord_manager (CoordinateManager | None)
coord_key (CoordinateMapKey | None)
- replace(*, feats)[source]¶
Return a feature replacement on the same coordinate support.
- Return type:
- Parameters:
feats (Tensor)
- with_coordinates(*, feats, coords, stride=None, spatial_range=<object object>, batch_counts=None)[source]¶
Return a value on newly created coordinate support.