bsky
bsky

Reputation: 20222

What is the sparse representation of a tensor

I has looking at the definition of tf.sparse_to_dense from here.

In the function's description, it's stated that it Converts a sparse representation into a dense tensor..

So what is a sparse representation?

Is the tensor represented in some compressed format rather than being a multidimensional array?

Upvotes: 1

Views: 1142

Answers (2)

Farooq Khan
Farooq Khan

Reputation: 578

My assumption is that a Sparse Tensor is similar to a Sparse Array or Sparse Matrix, in which most of the elements are zero. See this definition of Sparse Array/Matrix: https://en.wikipedia.org/wiki/Sparse_matrix

Conversely a Dense Tensor is opposite of Sparse Tensor in which most of the elements are non-zero

Upvotes: 0

Baptiste Arnaud
Baptiste Arnaud

Reputation: 2750

TensorFlow supports a SparseTensor representation for data that is sparse in multiple dimensions. Contrast this representation with IndexedSlices, which is efficient for representing tensors that are sparse in their first dimension, and dense along all other dimensions.

Sparse Tensor Representation

Upvotes: 2

Related Questions