@@ -30,7 +30,7 @@ data structures and automatically dispatch operations to the underlying namespac
3030instead of relying on NumPy.
3131
3232At this stage, this support is **considered experimental ** and must be enabled
33- explicitly as explained in the following .
33+ explicitly by the ` array_api_dispatch ` configuration. See below for details .
3434
3535.. note ::
3636 Currently, only `array-api-strict `, `cupy `, and `PyTorch ` are known to work
@@ -45,7 +45,13 @@ and how it facilitates interoperability between array libraries:
4545Example usage
4646=============
4747
48- Here is an example code snippet to demonstrate how to use `CuPy
48+ The configuration `array_api_dispatch=True ` needs to be set to `True ` to enable array
49+ API support. We recommend setting this configuration globally to ensure consistent
50+ behaviour and prevent accidental mixing of array namespaces.
51+ Note that we set it with :func: `config_context ` below to avoid having to call
52+ :func: `set_config(array_api_dispatch=False) ` at the end of every code snippet
53+ that uses the array API.
54+ The example code snippet below demonstrates how to use `CuPy
4955<https://cupy.dev/> `_ to run
5056:class: `~discriminant_analysis.LinearDiscriminantAnalysis ` on a GPU::
5157
@@ -82,8 +88,7 @@ transfers an estimator attributes from Array API to a ndarray::
8288PyTorch Support
8389---------------
8490
85- PyTorch Tensors are supported by setting `array_api_dispatch=True ` and passing in
86- the tensors directly::
91+ PyTorch Tensors can also be passed directly::
8792
8893 >>> import torch
8994 >>> X_torch = torch.asarray(X_np, device="cuda", dtype=torch.float32)
0 commit comments