MCPcopy Create free account
hub / github.com/alibaba/MNN / prefetch

Method prefetch

tools/train/source/data/DataLoader.cpp:50–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void DataLoader::prefetch(size_t nJobs) {
51 MNN_ASSERT(mJobs != nullptr);
52 for (int i = 0; i < nJobs; i++) {
53 auto batchIndices = mSampler->next(mConfig->batchSize);
54 Job j;
55 j.job = batchIndices;
56 if (batchIndices.size() != 0) {
57 if (mConfig->dropLast && batchIndices.size() < mConfig->batchSize) {
58 // drop the job
59 } else {
60 mJobs->push(std::move(j)); // the job may be empty when sampler is exhausted
61 }
62 }
63 }
64}
65
66void DataLoader::workerThread() {
67 while (true) {

Callers

nothing calls this directly

Calls 3

nextMethod · 0.45
sizeMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected