Representing Tensors as Compositions for Efficient Computation on Sparse and Structured Data
Abstract
We propose a new mathematical formalism in which all kinds of tensors and of operations on those tensors are represented as simple function compositions. Tensors are functions from indices to values. An element-wise operation (e.g. an activation function) is a composition with a function applied to values; re-indexing (e.g. reshape, transposition) is a composition with a function applied to indices; and a reduction is a composition with both an index function, mapping each index to several indices, and a reduction operation (e.g. product, sum, max). Combined with tensor stacking, these compositions can represent most interesting kinds of tensors (e.g. dense, jagged, all kinds of sparsity patterns, matrix factorizations), as well as lazy versions of almost every operation available in modern tensor computation frameworks, including einsums between tensors of any kind. Identities between compositions can then be used to rewrite such expressions into equivalent ones, without evaluating them. For instance, the product of two sparse matrices can be rewritten so that only products between non-zero values are computed, turning a sparse problem into a dense one. Using this algebra as the intermediate representation of a tensor computation engine would shift the focus from defining operations on tensors (e.g. einsum between sparse tensors) to defining an algebra on index functions. This should reduce the codebase complexity from , with the number of binary operations between tensors and the number of tensor types, to , with the number of types of index functions. A draft implementation of a tensor computation framework based on this algebra is publicly available.
Create a lesson
Related papers
SONATI: Spatio-temporal ocean neighbourhood asymmetric transformer for imputation of sparse, tabular data with uncertainty
Shared title terminology · Yvonne Jenniges, Boris Peter Koch, Maike Sonnewald et al.
Failure Modes and Data-Efficient Remedies for Transformer-Based Prediction of Viscoplastic Flows
Shared title terminology · Maedeh Saberi, Hugo Franca, Maziyar Jalaal et al.
Decision Aware Origin-Destination Demand Estimation with Structurally Constrained Data
Shared title terminology · Xianzhe Wang, Yueyue Fan, Johannes Royset
When Does Physics Beat Data? Data-Efficient Traffic State Estimation with Amortized PINNs
Shared title terminology · Anna Lazareva, Alexander Tarakanov
Computationally Efficient Offline Policy Optimization with All-Policy Linear Realizability
Shared title terminology · Zhijie Zheng
Jointly Optimizing Memory, Computing and Offloading for Energy-Efficient DNN Inference
Shared title terminology · Yunchu Han, Zhaojun Nan, Sheng Zhou et al.