Skip to content

Adding order argument to asarray #571

Closed
@fcharras

Description

@fcharras

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API changeChanges to existing functions or objects in the API.status: RejectedProposed change was not accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions