programdemos/cnn-digits/batch.xtl
The digit reader over a batch: the first 1,000 MNIST test digits as one batch through the Conv library (the windows of every picture, one product for the batch, the pooling), then the dense layer; how many digits it reads right, the count the trainer's Rust forward pass gives from the same pixels. The batch run for a GPU (docs/gpu-asks.md); cnn-digits.xtl is the lesson, a picture at a time.
The network, read from data/ (as cnn-digits.xtl reads it)
The batch: the test digits, their pixels as whole percents, and their labels
The reader
ᵘr̲ead : Float -> Int
The digit, 0 to 9, the network reads in each picture of a batch X: the filters over every window, ReLU, 2 x 2 pooling, the dense layer, the likeliest output. One function of arrays, the part a GPU takes.
ᵘr̲ead ← { X → (ⁿⁿa̲rgmax (((t̲ally X) c̲at 1352) r̲eshape ᶜᵛp̲ool ᵃᶜᵗr̲elu (9 t̲ake₂ fb, r̲avel -1 t̲ake₂ fb) ᶜᵛc̲onv X) ⁿⁿd̲ense wb) − 1 }
Used in: right