iskra.sparse#

SparseTensor(tensor, *[, layout, dtype, ...])

Sane PyTorch sparse tensor.

alias(x)

Creates an alias (view) of a tensor.

append(x, indices, values)

Appends new values to an existing COO tensor.

cat(xs[, dim])

Concatenates sparse COO matrices along a dimension.

coo_tensor(indices, values[, size, dtype, ...])

Constructs a COO SparseTensor from indices and values.

csr_tensor(crow_indices, col_indices, values)

Constructs a CSR SparseTensor from compressed-row data.

diag(values)

Constructs a sparse COO diagonal matrix from vector of diagonal elements.

eye(n[, dtype, device])

Constructs a sparse COO identity matrix.

fill_slice(x, fill_value, *indices)

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

from_scipy(x[, device])

Converts SciPy sparse COO/CSR arrays into PyTorch sparse tensors.

get_diag(mat)

Extracts diagonal from sparse COO matrix.

get_slice(x, *indices)

Slices a sparse tensor.

index_complement(n, idx)

Computes the complement of a set of linear indices.

inv_diag(mat)

Inverts elements of a diagonal COO matrix.

is_sparse_any(x)

Checks if tensor is either in sparse COO or CSR format.

isect_indices(a_idx, b_idx)

Checks which indices in two tensors apepar in both.

matmul(...)

Matrix-matrix product with support for sparse COO tensors.

mul(...)

Elementwise product of two tensors with support for sparse COO tensors.

mul_sparse_sparse(...)

Elementwise product of two sparse COO tensors.

ravel_indices(indices, shape)

Converts a COO indices into a linear index corresponding to a strided layout.

repdiag(x, n_reps)

Repeats a sparse COO matrix along a diagonal to make a block-diagonal matrix.

reshape(x, *shape)

Returns a sparse COO tensor with the same data, but with the specified shape.

square(x)

Elementwise square of sparse tensors.

to_scipy(x)

Converts PyTorch sprase COO/CSR tensors into SciPy sparse arrays.

unravel_index(linear, shape)

Converts a linear index into COO indices.

zero_slice(x, *indices)