Skip to content

Refactor: remove numpy and ml_dtypes dependencies#580

Merged
ChaoWao merged 1 commit intohw-native-sys:mainfrom
ChaoWao:remove-numpy-ml-dtypes-deps
Apr 16, 2026
Merged

Refactor: remove numpy and ml_dtypes dependencies#580
ChaoWao merged 1 commit intohw-native-sys:mainfrom
ChaoWao:remove-numpy-ml-dtypes-deps

Conversation

@ChaoWao
Copy link
Copy Markdown
Collaborator

@ChaoWao ChaoWao commented Apr 16, 2026

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.

  • 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]'
  • Add Dependencies section to python-packaging.md documenting the simpler vs simpler_setup dependency split
  • Update getting-started.md install commands and docstrings

Testing

  • Simulation tests pass (a2a3sim: 25 passed, 80 skipped, 0 failed)
  • Hardware tests pass (if applicable)

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread simpler_setup/code_runner.py Outdated
Comment thread simpler_setup/code_runner.py Outdated
@ChaoWao ChaoWao force-pushed the remove-numpy-ml-dtypes-deps branch from ffca5fb to 1ae500e Compare April 16, 2026 03:45
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
@ChaoWao ChaoWao force-pushed the remove-numpy-ml-dtypes-deps branch from 1ae500e to 2f25ba6 Compare April 16, 2026 06:13
@ChaoWao ChaoWao merged commit a9f3ea9 into hw-native-sys:main Apr 16, 2026
29 of 30 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.

1 participant