ravel_indices#
- iskra.sparse.ravel_indices(indices: Tensor, shape: Size | tuple[int, ...]) Tensor[SOURCE]#
Converts a COO indices into a linear index corresponding to a strided layout.
Example
The sparse tensor ``` a = [[1.0, 0.0],
[0.0, 2.0]]
``` has COO indices
a.indices() = [[0, 1], [0, 1]]. The linear index otutput isravel_index(a.indices()) = [0, 3].- Parameters:
indices (
Tensor[dim, nnz]) – Indices of a sparse tensor in COO format.shape (torch.Size | tuple[int, ...]) – Shape of the tensor.
- Returns:
(
Tensor[nnz]) – Linear indices into a strided layout tensor of same shape.