fill_slice#

iskra.sparse.fill_slice(x: SparseTensor, fill_value: float | int, *indices: slice | int | tuple[int, ...]) SparseTensor[SOURCE]#

Sets all nonzero entries in a slice of a sparse COO tensor to a chosen value.

This function leaves zero values unmodified. If you want to modify the zero values, use iskra.sparse.append(). See iskra.sparse.get_slice() to see how the slicing is performed.

Parameters:
  • x (SparseTensor) – Sparse tensor to fill.

  • fill_value (float | int) – The value for the nonzero entries in the slice.

  • *indices (None | slice | int | Tensor[bool | int, …] | tuple[int, …]) – Slicing masks, one per dimension of input tensor.

Returns:

(SparseTensor) – Tensor with modified nonzero entries within the slice.