Skip to main content

autoray-header

tests codecov Docs PyPI Anaconda-Server Badge Pixi Badge

autoray is a lightweight python AUTOmatic-arRAY library for abstracting your tensor operations. Primarily it provides an automatic dispatch mechanism that means you can write backend agnostic code that works for:

Beyond that, abstracting the array interface allows you to:

Basic usage

The main function of autoray is do, which takes a function name followed by *args and **kwargs, and automatically looks up (and caches) the correct function to match the equivalent numpy call:

import autoray as ar


def noised_svd(x):
    # automatic dispatch based on supplied array
    U, s, VH = ar.do("linalg.svd", x)

    # automatic dispatch based on different array
    sn = s + 0.1 * ar.do("random.normal", size=ar.shape(s), like=s)

    # automatic dispatch for multiple arrays for certain functions
    return ar.do("einsum", "ij,j,jk->ik", U, sn, VH)


# explicit backend given by string
x = ar.do("random.uniform", size=(100, 100), like="torch")

# this function now works for any backend
y = noised_svd(x)

# explicit inference of backend from array
ar.infer_backend(y)
# 'torch'

If you don't like the explicit do syntax, or simply want a drop-in replacement for existing code, you can also import the autoray.numpy module:

from autoray import numpy as np

# set a temporary default backend
with ar.backend_like("cupy"):
    z = np.ones((3, 4), dtype="float32")

np.exp(z)
# array([[2.7182817, 2.7182817, 2.7182817, 2.7182817],
#        [2.7182817, 2.7182817, 2.7182817, 2.7182817],
#        [2.7182817, 2.7182817, 2.7182817, 2.7182817]], dtype=float32)

Alternatively you can use autoray.get_namespace to get a backend specific (with optional default device and dtype) namespace object, (c.f. the Python Array Api):

xp = ar.get_namespace(z)
xp.einsum("ii->i", z)

Custom backends and functions can be dynamically registered with:

The main documentation is available at autoray.readthedocs.io.

Release files for autoray 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autoray 0.11.0
File Size Uploaded
autoray-0.11.0.tar.gz 1.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for autoray 0.11.0
File Interpreter ABI Platform
autoray-0.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.3 MB

Release files / autoray-0.11.0.tar.gz

Download URL autoray-0.11.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
ef9c23d8307f2e5030d10dd222d304401450157172a6fcc6f7456b6e82681bf4
BLAKE2b-256 checksum
How to use checksums
cd330a894071f0635b9f9a208ba4eabc3af80b5316e51ec7de7ada89a2bf097e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / autoray-0.11.0-py3-none-any.whl

Download URL autoray-0.11.0-py3-none-any.whl
Size 952.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e9ca95070834574e054162ee02946d2414f7821f65960308b95f49d08ee9227
BLAKE2b-256 checksum
How to use checksums
58a17e82580da9ad8a2ed06306856d25bc9ebc737db9331f566590ee15b0d4ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.11.0 This release

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.9

2 release files

0.8.8

2 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.12

2 release files

0.6.11

2 release files

0.6.10

2 release files

0.6.9

2 release files

0.6.8

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page