Refactor: remove numpy and ml_dtypes dependencies#580
Merged
ChaoWao merged 1 commit intohw-native-sys:mainfrom Apr 16, 2026
Merged
Refactor: remove numpy and ml_dtypes dependencies#580ChaoWao merged 1 commit intohw-native-sys:mainfrom
ChaoWao merged 1 commit intohw-native-sys:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes NumPy and ml_dtypes as dependencies, standardizing on PyTorch for tensor operations across the CI scripts, documentation, and the code runner. The _to_torch utility was simplified by removing NumPy fallback logic. Feedback identifies redundant .cpu().contiguous() calls in simpler_setup/code_runner.py and suggests further consolidation of tensor conversion logic using the _to_torch helper.
ffca5fb to
1ae500e
Compare
Project now uses torch exclusively for tensor operations. numpy was only used as a fallback conversion path and isinstance check; ml_dtypes had no remaining call sites. - Remove numpy fallback in _to_torch() and isinstance checks in code_runner.py and ci.py - Ensure _to_torch() always returns cpu+contiguous tensors; remove redundant .cpu().contiguous() at call sites - Remove pip install numpy/ml_dtypes from all CI workflow jobs; sim jobs now use pip install '.[test]' instead of separate installs - Add Dependencies section to python-packaging.md documenting the simpler vs simpler_setup dependency split - Update getting-started.md install commands and docstrings
1ae500e to
2f25ba6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Project now uses torch exclusively for tensor operations. numpy was only used as a fallback conversion path and isinstance check; ml_dtypes had no remaining call sites.
_to_torch()and isinstance checks incode_runner.pyandci.py_to_torch()always returns cpu+contiguous tensors; remove redundant.cpu().contiguous()at call sitespip install numpy/ml_dtypesfrom all CI workflow jobs; sim jobs now usepip install '.[test]'python-packaging.mddocumenting thesimplervssimpler_setupdependency splitgetting-started.mdinstall commands and docstringsTesting