ml-explore / mlx-data

Efficient framework-agnostic data loading
MIT License
362 stars 40 forks source link

support negative indexing of buffers #26

Closed dastrobu closed 10 months ago

dastrobu commented 10 months ago

The getitem method now accepts both positive and negative indices. Overflow issues are appropriately handled as out_of_range/IndexError, maintaining consistency with mx.array and other containers.

Additionally, an initial Python unit test has been included to kickstart the testing process.

Closes #18

Running tests from circleci is still missing, but that is hard to do from a fork (at least I don't know how). I personally just have experience with GH workflows.

angeloskath commented 10 months ago

Hi @dastrobu. This looks great, thanks for adding it and sorry for taking a while to merge it.

dastrobu commented 10 months ago

@angeloskath, no worries at all. I'd still consider that an instant merge. Recently I had a pull request merged in another open-source repository after over a year.