tracel-ai/burn

Support Sparse Tensors

Open

#846 opened on Oct 4, 2023

View on GitHub
 (12 comments) (5 reactions) (0 assignees)Rust (964 forks)auto 404
featurehelp wanted

Repository metrics

Stars
 (15,550 stars)
PR merge metrics
 (PR metrics pending)

Description

Feature description

A tensor representation that only stores data for positions where the value non-zero. Operations on sparse tensors could then be optimized based on the fact that most of the tensor is empty and only a few points need to be computed.

Feature motivation

Sometimes I (and others) deal with cases where tensors are always largely empty (often less than 1% full). In such cases, it would much more efficient (memory-wise and computationally) to only store data for indexes that are used. This is especially important for scenarios when the tensor would be very large if it were represented in a dense representation.

(Optional) Suggest a Solution

I don't have a concrete idea how this might be implemented, I imagine existing libraries (such as sprs in rust, or in other ecosystems) can serve as inspiration.

Contributor guide