ml-explore / mlx-data

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

Feature request: Support negative indexing on buffers #18

Closed dastrobu closed 10 months ago

dastrobu commented 10 months ago

Currently dx.Buffer does not seam to support pythonic negative indexing:

b = dx.buffer_from_vector(list(dict(i=i) for i in range(5)))

b[-1] throws

RuntimeError: FromVector: index out of range

However: b[len(b) - 1] works as expected. Would be nice to support the python convention to use negative indices.