--- id: tensorly version: "0.9.0" license: Modified BSD license_treatment: permissive maintenance: aging --- # tensorly — Tensor learning in Python. License: permissive · Maintenance: aging · Downloads: 110.0K/mo ## 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 above — 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 pip install tensorly uv add tensorly 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: unspecified - Install friction: low - Maintenance: aging - Downloads: 110.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags tensor decomposition library, tensor learning python, tensor algebra operations, multi-backend tensor computation, tucker cp decomposition, tensor factorization, gpu tensor operations, tensor-decomposition, multi-backend, numerical-computing [View on SkillFed](https://skillfed.io/packages/tensorly) · [View on PyPI](https://pypi.org/project/tensorly/)