forked from ml-explore/mlx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes ml-explore#1786 Add `bincount` method to MLX to count occurrences of each value in an array. * **mlx/array.cpp**: Implement `bincount` method using `std::unordered_map` to store counts and return an array with the counts of each value in the input array. * **mlx/array.h**: Declare `bincount` method in the `array` class. * **python/src/array.cpp**: Add `bincount` method to the Python API for the `array` class and implement it using the `bincount` method from `mlx/array.cpp`. * **python/tests/test_array.py**: Add test cases for the `bincount` method in the `array` class to verify its correctness with various input arrays. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/ml-explore/mlx/issues/1786?shareId=XXXX-XXXX-XXXX-XXXX).
- Loading branch information
Showing
4 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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