Changelog¶
Release notes for autoray.
v0.11.0 (2026-08-22)¶
Enhancements:
composenow supplies anAutoNamespaceto any default implementation taking anamespaceparameter: the namespace itself when called asxp.my_func(...), so its dtype and device defaults apply, otherwise one from the first argument if it matches the dispatched backend. Implementations registered for a specific backend keep their own signatures.Namespaces from
get_namespaceare now stable objects: registering a function drops their cached lookups rather than discarding the namespaces, so one already held picks up the new function.autoray.lazy"sum","prod","min"and"max"now acceptkeepdims, matching the eager and array API signatures. The reduced axes are kept as size 1 in the inferred lazy shape.Added the lazy reductions
"mean","std","var","all","any","count_nonzero","argmin"and"argmax", which also takeaxisandkeepdims, and"cumsum", which takesaxisand accumulates over the flattened array when it isNone."argmin"and"argmax"follow the eager convention of only accepting a scalaraxis. Backend support forkeepdimsvaries: seeXFAILSintests/conftest.py.The lazy reductions and
"cumsum"pass any further keyword arguments, such asddofordtype, straight through to the backend function. ALazyArraysupplied this way, for example aswhere, is tracked as a dependency of the result.
Bug Fixes:
autoray.lazyreductions now passaxison as supplied, rather than always normalizing it to a tuple.do("prod", x, axis=0)on a lazytorcharray therefore works, sincetorch.prodonly accepts a scalardim.
v0.10.1 (2026-08-07)¶
This is a re-release of v0.10.1, see below.
v0.10.0 (2026-08-06)¶
Enhancements:
Added
random_array, i.e.do("random.array", ...), for backend-agnostic normal, uniform and rademacher random arrays. It accepts backend-specific generators or seeds, inherits dtype and device fromlike, and generates complex normal samples with unit total variance. A complex rademacher sample is a choice from the four roots of unity, so it also has modulus one.jax"random.default_rng"withseed=Nonewarns one time, because tracing fixes its generated seed.jax,mlxandtensorflow"random.default_rng"now default toseed=None, andjaxalso accepts a key.torch"random.default_rng"accepts atorch.Generator, and raises a descriptive error if a device is also requested that the generator cannot supply.Added a random numbers documentation guide, covering
random_array, the generator objects and their per backend method coverage, the shared random state, the complex normal convention, and the rules forjax.jitandtorch.compile.
Bug Fixes:
torch"random.normal"and"random.uniform"now generate at the requesteddtyperather than casting afterwards. A complexdtypetherefore gets a complex sample rather than a real one cast up, which previously left the imaginary part zero, andfloat64now carries full double precision entropy.torch"random.seed"is now registered, and seeds the shared random state. Previously it resolved totorch.random.seed, which takes no seed and thus raisedTypeError.tensorflow"random.seed"is now registered, as an alias oftf.random.set_seed. Previously it raisedImportError.mlxnow uses mlx’s own shared random state, rather than a separate module level generator of autoray’s.do("random.seed", seed, like="mlx")therefore reachesmx.random.seed, and mixing autoray and rawmlx.core.randomcalls is now reproducible in both directions.
v0.9.1 (2026-08-03)¶
Bug Fixes:
Registration now removes the cache entries that depend on it. A registration applies immediately, also to functions and classes that autoray used before. Previously,
register_functionwithmodule=,alias=orwrapper=had no effect if the code called the function first, because only the first import of a function reads these three arguments.register_backendandregister_backend_aliasnow clear the caches that hold the backend of each class. Autoray then finds the new backend, also for a class that it used before.tree_register_containernow clears the pytree dispatch caches. Autoray then uses the new functions for a container class, also if it used that class as a leaf before, or if it used the functions of a parent class.Registration also clears the namespaces from
get_namespaceand the dtype cache ofto_backend_dtype. A namespace object that you already have keeps the functions that it found. This is the correct behavior: get a new namespace to use a later registration.autorayno longer shows the internal exception chain in theImportErrorthat it raises when it cannot find a function.torch"random.default_rng"now defaults toseed=None
v0.9.0 (2026-07-15)¶
Enhancements:
Added
tofor converting arrays, or nested collections (“pytrees”) of arrays, to a target backend, dtype and/or device, all specifiable in a single string such as"torch-float32-cuda:0", via explicit kwargs, or an example array. Repeated references to the same input array are converted once and share the same output array. Matchingtorch.nn.Module.tosemantics, only floating point and complex arrays are cast when a dtype is given, so e.g. integer index arrays are preserved.Added
to_devicecomposed function for moving arrays between devices, with"gpu"accepted as an alias for"cuda"where relevant, and a bare device type such as"gpu"meaning ‘ensure on this type of device’, without migrating arrays between device indices.Added
from_numpycomposed creation routine for converting a numpy array into a backend array, directly with a given dtype and on a given device where possible, e.g. via a singletorch.as_tensorcall. An example array supplied aslikesupplies its backend, dtype and device as defaults.Made
to_numpya composed function with default implementationnp.asarray, so that unknown backends are handled automatically.Reworked
register_functioninto the single entry point for all function-level registration, takingmodule=,alias=,wrapper=,inject_dtype=andinject_device=, deprecatingregister_creation_routine.Dtype name resolution now handles scalar types such as
np.float32and builtins such asfloatandcomplex, anywhere a dtype is specified.MLX:
arrayandasarraynow preserve the input array’s dtype rather than applying mlx defaults, e.g. no longer silently downcasting float64 to float32.MLX:
count_nonzeronow uses the native mlx implementation where available (v0.32+), falling back to a manual version which also supports theaxisandkeepdimskwargs.The
"backend[alt]"fallback, used when a function is missing from an older version of a library, now also finds directly registered implementations, and caches its result against the original backend so the lookup only happens once.MLX: requesting a device warns that mlx arrays live in unified memory with per-op computation placement, rather than failing generically.
Lazy:
to_numpyandto_deviceonLazyArrays now raise explicit errors, whilefrom_numpycreates a lazy leaf node.Added the
testcupypixi environment, and refreshed the contributing and developer guides, including a code of conduct and AI policy.
Bug Fixes:
Fixed
get_namespacecaching for backends with unhashable device objects such ascupy.cuda.Device.Added cupy
linalg.choleskysupport for theupperkwarg via the new genericcholesky_manual_upperwrapper.Torch:
random.default_rngnow only inherits floating point dtypes from thelikeargument and creates generated arrays on the same device as its generator.
v0.8.11 (2026-06-08)¶
Enhancements:
Added initial MLX backend support including
random.default_rng, dtype-aware creation wrappers,to_numpy,count_nonzero,ravel, andlinalg.svdsupport.Added
infer_backend_device_dtypefor shared backend, device, and dtype inference fromlikevalues.Exported
DoFuncfor reusable call-time auto-dispatch, with fasterdoandget_namespacedispatch paths.Refreshed package metadata, pixi environments, docs infrastructure, and CI, including the
testmlxenvironment and MLX CI job.Reworked backend tests around the unified
XFAILSregistry and expanded linear algebra coverage.
Bug Fixes:
Cached failed
.deviceand.dtypeprobes inget_namespaceto avoid repeated slow exceptions for array classes such as JAX tracers (PR #30).Fixed
autojitwith lazylazy_astypedtype evaluation.Added TensorFlow
astypehandling and a NumPy-like Torchnonzerowrapper.Fixed reduced and batched SVD shape handling in
svd_manual_full_matrices_kwarg.Fixed
prime_factorsto preserve integer factors.
Previous release notes can be found on the project releases page.