public static load<T extends AbstractFloat = Float>(folder as Path = null, trainLimit as Long = 0l, testLimit as Long = 0l, download as Boolean = true) as Tuple<NDArray<T>, NDArray<Int>, NDArray<T>, NDArray<Int>>
Loads the train and t10k IDX image/label files, downloading missing files. Each filename ends in -images-idx3-ubyte or -labels-idx1-ubyte. Input is streamed into the returned tensors, without retaining another complete byte dataset. Reusable byte blocks are normalized directly into typed floating storage, without allocating an object per pixel. Loading all images uses about 105 MiB of FP16 or 210 MiB of FP32 image data. Missing files are fetched over HTTPS, verified and decompressed into the cache. Existing IDX files are reused without network access. Downloads use the curl executable; decompression uses Klyn's own DEFLATE implementation. Interactive downloads show a live progress bar on standard error; cached loads are silent and redirected output uses plain status messages.
| Parameter | Description |
|---|---|
<T> | Float16, Float or Double image storage; labels remain Int. |
folder | IDX directory; null selects ~/datasets/mnist. |
trainLimit | Leading training samples; zero selects the whole split. |
testLimit | Leading test samples; zero selects the whole split. |
download | Allow retrieval of missing files; false requires local IDX files. |
(xTrain, yTrain, xTest, yTest), in that exact order.
xTrain, yTrain, xTest, yTest = MNIST.load(trainLimit=2000, testLimit=1000)