skillfed

tensorly

Tensor learning in Python.

tensorly v0.9.0 110.0K downloads/30d#12,489 on PyPI1,689
Permissive license Modified BSD AGING released

What it is and what it does

TensorLy is a Python library for tensor operations—decomposition, learning, and algebra—built on top of numpy and scipy. It abstracts away the computational backend so you can write tensor code once and run it on NumPy arrays, PyTorch tensors, JAX arrays, or other frameworks without rewriting. You define which backend to use, and all operations transparently use that framework's compute engine, including GPU acceleration when available.

The library covers standard tensor decompositions (Tucker, CP, TT-format and others), random tensor generation, unfolding/folding operations, and tensor reconstruction. It's designed for researchers and practitioners who need to prototype or deploy tensor methods across different computational backends without maintaining separate codebases for each one.

Use it for:

  • Prototype tensor decomposition algorithms in NumPy, then run the same code on GPU via PyTorch or TensorFlow for production.
  • Perform Tucker or CP decomposition on large multidimensional datasets for dimensionality reduction or feature extraction.
  • Build machine learning pipelines that work with both CPU and GPU backends by switching a single configuration parameter.
  • Unfold and manipulate high-order tensors for signal processing, chemometrics, or scientific computing workflows.
  • Experiment with different tensor factorization methods on the same data without rewriting tensor algebra code.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

TensorLy performs tensor decomposition, tensor learning, and tensor algebra operations with a pluggable backend system that lets you compute using NumPy, PyTorch, JAX, TensorFlow, CuPy, or Paddle.

Yes, if you need tensor decomposition and can accept a slower release cycle. The library has low install friction, permissive licensing, no known vulnerabilities, and a multi-backend design that justifies the abstraction overhead. The aging maintenance status is a minor concern but not a blocker—the repository is not archived and recent commits exist. Install it for prototyping or production use of tensor methods across NumPy, PyTorch, or other backends.

Install

tensorly on PyPI

pip

pip install tensorly

uv

uv add tensorly

poetry

poetry add tensorly

Installing tensorly

Before you install

Low install friction with only numpy and scipy as runtime dependencies. The package is aging (640 days since last release) but the repository remains active with recent commits and no archived status, suggesting ongoing maintenance despite the slower release cadence.

License in practice

Licensed under Modified BSD (permissive), which allows commercial and private use with minimal restrictions—suitable for most projects that can include the license text.

Quickstart

pip install tensorly

import tensorly as tl
import numpy as np

tensor = tl.tensor(np.arange(24).reshape((3, 4, 2)))
unfolded = tl.unfold(tensor, mode=0)
reconstructed = tl.fold(unfolded, mode=0, shape=tensor.shape)

Requires Python 3; optional backends (PyTorch, TensorFlow, JAX, CuPy, Paddle) must be installed separately if you want to use them instead of NumPy.

Verify before relying

  • Whether the aging status (640 days since release) reflects planned maintenance cycles or slowing development momentum.
  • Performance characteristics and scalability limits for large-scale tensor operations on GPU.
  • Completeness and currency of documentation relative to the latest decomposition methods in the field.

Package facts

License Modified BSD (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — numpy, scipy
Maintenance aging — 640 days since the last release
Last repo commit
First released
Downloads 109,991/month — #12,489 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tensorly-0.9.0-py3-none-any.whl

License :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 3Topic :: Scientific/Engineering

Tags

tensor decomposition librarytensor learning pythontensor algebra operationsmulti-backend tensor computationtucker cp decompositiontensor factorizationgpu tensor operations
tensor-decompositionmulti-backendnumerical-computing

More Scientific/Engineering packages