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

Method next

mlx/data/stream/Batch.cpp:25–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25Sample Batch::next() const {
26 std::vector<Sample> samples;
27 for (int i = 0; i < batchSize_; i++) {
28 auto sample = stream_->next();
29 if (sample.empty()) {
30 break;
31 }
32 samples.push_back(std::move(sample));
33 }
34 if (samples.empty()) {
35 return Sample();
36 } else {
37 return core::merge_batch(samples, padValues_, batchDims_);
38 }
39}
40
41void Batch::reset() {
42 stream_->reset();

Callers 1

bufferize_Method · 0.45

Calls 1

merge_batchFunction · 0.85

Tested by

no test coverage detected