ak.to_backend#
Defined in awkward.operations.ak_to_backend on line 16.
- ak.to_backend(array, backend, *, highlevel=True, behavior=None, attrs=None)#
- Parameters:
array – Array-like data (anything
ak.to_layoutrecognizes).backend (
"cpu","cuda","jax", or"typetracer") – If"cpu", the array structure is recursively copied (if need be) to main memory for use with the default Numpy backend; if"cuda", the structure is copied to the GPU(s) for use with CuPy. If"jax", the structure is copied to the CPU for use with JAX.highlevel (bool) – If True, return an
ak.Array; otherwise, return a low-levelak.contents.Contentsubclass.behavior (None or dict) – Custom
ak.behaviorfor the output array, if high-level.attrs (None or dict) – Custom attributes for the output array, if high-level.
Converts an array from
"cpu","cuda","jax"kernels to"cpu","cuda","jax", or"typetracer".Any components that are already in the desired backend are viewed, rather than copied, so this operation can be an inexpensive way to ensure that an array is ready for a particular library.
To use
"cuda", thecupypackage must be installed, either with:pip install cupy
or:
conda install -c conda-forge cupy
To use
"jax", thejaxpackage must be installed, either with:pip install jax
or:
conda install -c conda-forge jax
See
ak.kernels.