- ak.to_backend(array, backend, *, highlevel=True, behavior=None, attrs=None)#
array – Array-like data (anything
"jax") – 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.
attrs (None or dict) – Custom attributes for the output array, if high-level.
Converts an array from
"jax" kernels to
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.
cupy package must be installed, either with
pip install cupy
conda install -c conda-forge cupy
jax package must be installed, either with
pip install jax
conda install -c conda-forge jax