std :: ml::datasets
Struct std::DataLoader
struct DataLoader {
&FloatTensor x;
&FloatTensor y;
&heap unsigned long order;
unsigned long n;
unsigned long batchSize;
unsigned long pos;
int shuffle;
int device;
struct Rng rng;
}Iterates a dataset in batches of 'batchSize' (the last one may be smaller), in a fresh random order every epoch when 'shuffle'.
Fields
DEVICE_CPU, or where to() put the data (batches are gathered there)
Methods
Fills 'out' with the next batch (new tensors, in the active tensor arena if any) and returns 1, or returns 0 at the end of an epoch and rewinds (reshuffling) for the next one.
batches per epoch
Keeps the dataset on 'device' (its tensors gain a device copy, uploaded once) and gathers each batch there; 1 on success, else the loader stays on the CPU.
= drop()
§
static struct DataLoader new(
const &Dataset ds,
unsigned long batchSize,
int shuffle,
unsigned long seed,
)source · definition