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

Method next

tools/train/source/data/DataLoader.cpp:34–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34std::vector<Example> DataLoader::next() {
35 if (mConfig->numWorkers == 0) {
36 auto batchIndices = mSampler->next(mConfig->batchSize);
37 MNN_ASSERT(batchIndices.size() != 0); // the sampler is exhausted, should reset the data loader
38 if (mConfig->dropLast && batchIndices.size() < mConfig->batchSize) {
39 MNN_ASSERT(false); // the sampler is exhausted
40 }
41 auto batch = mDataset->getBatch(batchIndices);
42 return batch;
43 } else {
44 auto batch = mDataQueue->pop();
45 prefetch(1);
46 return batch;
47 }
48}
49
50void DataLoader::prefetch(size_t nJobs) {
51 MNN_ASSERT(mJobs != nullptr);

Callers 15

quanDemo.pyFile · 0.45
prefetchMethod · 0.45
runMethod · 0.45
trainMethod · 0.45
_testFunction · 0.45
_trainFunction · 0.45
_testFunction · 0.45
_trainFunction · 0.45
runMethod · 0.45
trainMethod · 0.45
runMethod · 0.45
PyMNNDataLoader_nextFunction · 0.45

Calls 3

prefetchFunction · 0.85
sizeMethod · 0.45
popMethod · 0.45

Tested by 3

runMethod · 0.36
test_funcFunction · 0.36
test_funcFunction · 0.36