Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLXArray (Data, Dtype) constructor , DType size. #158

Merged
merged 6 commits into from
Dec 4, 2024

Conversation

louen
Copy link
Contributor

@louen louen commented Oct 24, 2024

This PR provides a fix for #157 by offering a new convenience initializer for MLXArray.

MLXArray init from data

  • new constructor for MLXArray taking Data, an optional shape (assuming a 1D array if unspecified) and a dtype.
  • should behave similarly as existing constructor daking Data and an explicit HasDtype type.

Modifications to DType

  • DType enum now conforms to Codable (saving the underlying raw value)
  • DType enum is now CaseIterable (mostly useful for testing all dtypes)
  • Dtype now expose size as a computed variable (Expose DType size through the C api mlx-c#39), the memory size of the associated type

@louen louen marked this pull request as ready for review November 20, 2024 19:16
Signed-off-by: Valentin Roussellet <[email protected]>
Signed-off-by: Valentin Roussellet <[email protected]>
Signed-off-by: Valentin Roussellet <[email protected]>
Signed-off-by: Valentin Roussellet <[email protected]>
@louen
Copy link
Contributor Author

louen commented Nov 20, 2024

(rebased on latest main)

Copy link
Collaborator

@davidkoski davidkoski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the improvements!

@davidkoski davidkoski merged commit 7f02cd8 into ml-explore:main Dec 4, 2024
3 checks passed
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.

2 participants