MCPcopy Create free account
hub / github.com/ml-explore/mlx-data / next

Method next

python/src/wrap_buffer.cpp:18–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16 PyBufferIterator(Buffer& buffer)
17 : buffer_(buffer), iter_(0), size_(buffer.size()) {};
18 py::dict next() {
19 if (iter_ >= size_) {
20 throw py::stop_iteration();
21 } else {
22 Sample res;
23 {
24 py::gil_scoped_release release;
25 res = buffer_.get(iter_++);
26 }
27 return mlx::pybind::to_py_sample(res);
28 }
29 };
30 Buffer buffer_;
31 int64_t iter_;
32 int64_t size_;

Callers

nothing calls this directly

Calls 2

to_py_sampleFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected