src.utils.sparse¶
Functions
Bilinear and diagonal in sequence, for diagonal(sparse x dense x sparse) -> dense vector. |
|
Convert a dense tensor to a sparse one. |
|
Get batches from a 3d sparse tensor. |
|
Recover scipy.sparse coo_matrix from a dictionary containing row, col and data tensors. :param t_dict: containing keys ‘row’, ‘col’, ‘data’, each corresponds to a bxn tensor ‘shape’, containing the MxN shape of each tensor :return: list of scipy.sparse matrix. list indices represent batches. |
|
Perform bmm (Batch Matrix Matrix) for sparse x dense -> dense. |
|
Perform bmm and diagonal for sparse x dense -> dense. |
|
Perform bmm and diagonal for sparse x dense -> dense. |
|
bmm (Batch Matrix Matrix) for sparse x dense -> dense. |
|
bmm (Batch Matrix Matrix) for sparse x dense -> sparse. |
|
Perform bmm for sparse x dense -> sparse. |
|
A slicing function for torch sparse tensors. :param s_t: input sparse tensor :param slice: tensor containing indices, -1 stands for all. For example, (1, -1) returns the second row of a 2d tensor. :param preserve_dim: If True, the dimension of the original tensor will be preserved, i.e. 1 will be padded for those removed dimensions. :return: sliced sparse tensor. |
|
Convert scipy.sparse matrix to torch sparse matrix. Since scipy.sparse has a dimension limit of 2, list of matrices is supported for batches. :param M: input scipy.sparse matrix :param batch: the type that represent batches in the output. If batch=’list’, tensors are 2d and stored in list. If batch=’dim’, tensors are 3d ane the first dimension represents batch size. :param dtype: output data type :param device: device :return: output torch sparse matrix. |
|
bmm (Batch Matrix Matrix) for sparse x sparse -> sparse. |
|
Perform bmm and diagonal for sparse x sparse -> sparse. |
|
converts dense tensor x to sparse format |
|
Convert torch sparse matrix to scipy.sparse matrix. |
Classes
bmm (Batch Matrix Matrix) for sparse x dense -> dense. |