Implement TypeScript wrapper for mlx.core.arange() - #549
Merged
Conversation
Co-authored-by: sydneyrenee <188732394+sydneyrenee@users.noreply.github.com>
Co-authored-by: sydneyrenee <188732394+sydneyrenee@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement mlx.core.arange() function
Implement TypeScript wrapper for mlx.core.arange()
Oct 16, 2025
sydneyrenee
approved these changes
Oct 16, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements the TypeScript wrapper for mlx.core.arange(), making the function accessible from the Node.js API. The implementation adds the JavaScript/TypeScript interface layer over the existing C++ implementation.
- Added TypeScript wrapper function with comprehensive JSDoc documentation and overloaded signatures
- Exported the function and associated types from the core module
- Added extensive test coverage for all usage patterns and edge cases
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| node/src/core/ops.ts | Implements the arange function with TypeScript wrapper and ArangeOptions interface |
| node/src/core/index.ts | Exports arange function and ArangeOptions type from core module |
| node/src/index.ts | Adds top-level exports for arange and dtype constants |
| node/test/core/ops.test.ts | Comprehensive test suite covering all arange functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
|
@copilot Address comments |
Contributor
Author
I don't see any specific comments or feedback in the PR that need to be addressed. The implementation appears complete:
Could you please point me to the specific comments or issues you'd like me to address? |
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.
Overview
This PR implements the TypeScript/JavaScript wrapper for
mlx.core.arange(), making the function accessible from the Node.js API. The C++ implementation was already present innode/src/native/array.ccand registered in the addon, but lacked the TypeScript interface layer.Changes
TypeScript Wrapper (
node/src/core/ops.ts)Added the
arange()function with full signature support:The implementation:
dtypeparameter for explicit type controlstreamparameter for stream-aware executionzeros,ones, andfulloperationsExports
node/src/core/index.ts: ExportedarangeandArangeOptionstype from core modulenode/src/index.ts: Added top-level exports forarangeand dtype constants (int32, float32, float16, etc.) for convenienceComprehensive Tests (
node/test/core/ops.test.ts)Added 17 test cases covering:
arange(0, 3, 0.5)→[0, 0.5, 1, 1.5, 2, 2.5]arange(0, -5, -1)→[0, -1, -2, -3, -4]Tests align with the C++ test suite in
tests/creations_tests.cpp.Implementation Notes
ArangeOptionsinterface for TypeScript usersTesting
TypeScript compilation passes successfully. The implementation is ready for integration testing once the native addon build is available in CI.
Fixes #[issue_number]
Original prompt
Fixes #504
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.