liveBook · Manning

Sparse representation

As explained in Deep Learning with JAX

A tensor representation that stores only non-zero values to reduce memory usage.

When a tensor contains many zeros and relatively few non-zero values, storing every element wastes memory. A sparse tensor stores only the non-zero values, which can substantially reduce memory usage. section 3.3.2

Use sparse tensors with care:

  • Pair sparse storage with linear algebra routines that support sparsity; ordinary dense operations may not exploit the representation efficiently. section 3.3.2
  • JAX exposes sparse tensors and sparse matrix operations through the experimental jax.experimental.sparse API, whose design may change. section 3.3.2

A mostly empty tensor

A tensor representing sparse data may contain many zero-valued elements and only a small number of non-zero ones. A sparse representation keeps the non-zero values instead of explicitly storing the zeros. section 3.3.2

How Deep Learning with JAX covers it

How deep it goes
Defines sparse storage and its tradeoff, but defers the experimental API and implementation details.
Examples
Illustrates tensors containing many zero-valued elements and comparatively few non-zero values.
What it assumes
Assumes familiarity with dense tensors before contrasting explicit and sparse value storage.
What you can do after
Evaluate when sparse storage could save memory and recognize the need for sparsity-aware operations.
How it connects
Connects sparse tensors with dense tensors, sparse matrix operations, and sparsity-aware linear algebra routines.

Also explained in

Compare how 4 books explain sparse representation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with JAX. The section links point to the parts of the book it draws on.