| 64 | } |
| 65 | |
| 66 | void DataLoader::workerThread() { |
| 67 | while (true) { |
| 68 | auto currentJob = mJobs->pop(); |
| 69 | if (currentJob.quit) { |
| 70 | break; |
| 71 | } |
| 72 | // make sure there are no empty jobs, so that there are no empty batch |
| 73 | MNN_ASSERT(currentJob.job.size() != 0); |
| 74 | auto batch = mDataset->getBatch(currentJob.job); |
| 75 | mDataQueue->push(std::move(batch)); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | void DataLoader::join() { |
| 80 | for (int i = 0; i < mConfig->numWorkers; i++) { |