dgl.sparse.SparseMatrix.nnz

property SparseMatrix.nnz: int

Returns the number of non-zero elements in the sparse matrix.

Returns:

The number of non-zero elements of the matrix

Return type:

int