11 std::condition_variable &sharedCV,
const std::vector<std::size_t> &vecSizes,
12 std::size_t numEntries,
bool dropRemainder)
13 : fBatchSize(batchSize),
18 fNumEntries(numEntries),
19 fDropRemainder(dropRemainder)
129 std::size_t chunkSize = chunkTensor.
GetRows();
130 std::size_t numCols = chunkTensor.
GetCols();
131 std::size_t numBatches = chunkSize /
fBatchSize;
132 std::size_t leftoverBatchSize = chunkSize %
fBatchSize;
135 std::vector<std::unique_ptr<RFlat2DMatrix>> batches;
138 for (std::size_t i = 0; i < numBatches; i++) {
145 chunkTensor.
GetData() + (numBatches *
fBatchSize * numCols + leftoverBatchSize * numCols),
150 std::size_t emptySlots =
fBatchSize - PrimaryLeftoverSize;
153 if (emptySlots >= leftoverBatchSize) {
159 if (emptySlots == leftoverBatchSize) {
163 batches.emplace_back(std::move(copy));
172 else if (emptySlots < leftoverBatchSize) {
175 std::copy(LeftoverBatch.
GetData(), LeftoverBatch.
GetData() + (emptySlots * numCols),
180 std::copy(LeftoverBatch.
GetData() + (emptySlots * numCols),
187 batches.emplace_back(std::move(copy));
201 batches.emplace_back(std::move(copy));
209 std::lock_guard<std::mutex> lock(
fLock);
210 for (
auto &batch : batches) {
RBatchLoader(std::size_t batchSize, const std::vector< std::string > &cols, std::mutex &sharedMutex, std::condition_variable &sharedCV, const std::vector< std::size_t > &vecSizes={}, std::size_t numEntries=0, bool dropRemainder=false)