Skip to content

Add from_dlpack to the array API namespace#3671

Open
Ritesh102000 wants to merge 1 commit into
ml-explore:mainfrom
Ritesh102000:add-from-dlpack-array-api
Open

Add from_dlpack to the array API namespace#3671
Ritesh102000 wants to merge 1 commit into
ml-explore:mainfrom
Ritesh102000:add-from-dlpack-array-api

Conversation

@Ritesh102000

Copy link
Copy Markdown

Fixes part of #3484.

Adds from_dlpack to the MLX array API namespace (mlx.core), so x.__array_namespace__().from_dlpack(...) is available, consistent with the Python array API standard. It reuses the existing create_array DLPack / ndarray import path that mx.array and asarray already use, plus a focused test (test_array_namespace_from_dlpack).

Note: asarray(..., copy=...) (the other item in #3484) already landed in #3510, so no change was needed there.

Exposes from_dlpack on mlx.core so that
array.__array_namespace__().from_dlpack(...) is available, matching the
Python array API standard. It reuses the existing create_array DLPack /
ndarray import path that mx.array and asarray already use, and adds a
focused test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant