skillfed

autoray

Abstract your array operations.

autoray v0.10.1 658.1K downloads/30d#5,472 on PyPI174
Permissive license Apache-2.0 Active released

What it is and what it does

Autoray is a lightweight library that lets you write array code once and run it on any NumPy-compatible tensor backend. Instead of writing separate code paths for NumPy, PyTorch, JAX, CuPy, and other array libraries, you call `ar.do()` with a function name and let autoray route the call to the right backend based on the input array type. It also provides a drop-in NumPy-like interface and utilities for registering custom backends and functions.

The library solves the problem of backend lock-in: if you build a numerical algorithm in NumPy but later want to run it on GPU with CuPy or use JAX for automatic differentiation, you can do so without rewriting your core logic. It's particularly useful for library authors who want to support multiple backends without maintaining separate implementations.

Use it for:

  • Write numerical algorithms that work on CPU (NumPy) or GPU (CuPy/PyTorch) without code duplication.
  • Build libraries that support multiple tensor backends without explicit backend-specific branches.
  • Migrate existing NumPy code to JAX or PyTorch by swapping the backend without rewriting function calls.
  • Lazy evaluation and computation tracing across different backends using autoray's abstraction layer.
  • Register custom tensor types or backend-specific optimizations while keeping the main algorithm backend-agnostic.

Worth the install?

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

Autoray provides automatic dispatch of array operations across multiple tensor backends (NumPy, PyTorch, JAX, CuPy, MLX, Dask, TensorFlow, and others) without requiring backend-specific code.

Yes. Autoray is actively maintained, has no dependencies, installs cleanly, and solves a real problem for anyone writing numerical code that might need to run on multiple tensor backends. The permissive Apache license and support for current Python versions make it a low-risk addition. Install it if you're building libraries or algorithms that should work across NumPy, PyTorch, JAX, or other array-like libraries.

Install

autoray on PyPI

pip

pip install autoray

uv

uv add autoray

poetry

poetry add autoray

Installing autoray

Before you install

Low friction installation with no runtime dependencies. Active maintenance with a release 7 days ago and recent commits; the project has been stable since its 2019 inception.

License in practice

Apache-2.0 permissive license allows use in commercial and proprietary projects with minimal restrictions.

Quickstart

import autoray as ar

# Automatic dispatch based on array type
U, s, VH = ar.do("linalg.svd", x)

# Or use the numpy-like interface
from autoray import numpy as np
z = np.ones((3, 4))

Requires Python 3.11 or later.

Verify before relying

  • Whether performance overhead of dispatch is negligible for tight loops or compute-heavy workloads.
  • Completeness of coverage for less common NumPy functions across all supported backends.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 7 days since the last release
Last repo commit
First released
Downloads 658,067/month — #5,472 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: autoray-0.10.1-py3-none-any.whl

Keywords: agnostic, array, autograd, cupy, dask, dispatch, jax, mlx, numeric, numpy, tensor, tensorflow

Development Status :: 4 - BetaIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering

Tags

backend-agnostic array operationsnumpy-like api abstractionautomatic tensor dispatchmulti-backend array librarywrite once run anywhere arraystensor framework agnosticarray backend switching
array-abstractionbackend-agnosticdispatch

More Scientific/Engineering packages