Closed
Description
A usecase I'm confronted to is to ensure that a given array has either a C or F memory layout.
The layout can be important when optimizing memory access patterns in lower level code. For instance in sklearn
KMeans
requires C
order. Typically xp.asarray(X, order=order)
is used to check that the input order matches the required order (if copy=False
), or will trigger a copy if necessary to get the expected order (if copy!=False
), before passing the array to lower level code (e.g cython or jitted functions).
Here's an example of API implemented by dpctl.tensor
, an array-API compatible array library, that also exposes the order
parameter to asarray
.