--- id: autoray version: "0.10.1" license: Apache-2.0 license_treatment: permissive maintenance: active --- # autoray — Abstract your array operations. License: permissive · Maintenance: active · Downloads: 658.1K/mo ## 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 above — 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 pip install autoray uv add autoray 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_current - Install friction: low - Maintenance: active - Downloads: 658.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags backend-agnostic array operations, numpy-like api abstraction, automatic tensor dispatch, multi-backend array library, write once run anywhere arrays, tensor framework agnostic, array backend switching, array-abstraction, backend-agnostic, dispatch [View on SkillFed](https://skillfed.io/packages/autoray) · [View on PyPI](https://pypi.org/project/autoray/)