sourcelibs/Accel/demos/tiny-net.xtl

1⍝!/usr/bin/env xetal 2⍝ A tiny network: four examples of three inputs, a dense layer of four 3⍝ with ReLU, a dense layer of two with softmax; the weights (with their 4⍝ bias rows) read from data files. Each row of the output is a 5⍝ probability per class. Run with "just demo-lib Accel tiny-net". 6ᵃᶜ⁼u̲se< "Accel" 7w1 ← 4 5 r̲eshape n̲umbers ⎕N̲GET "../data/w1.txt" 8w2 ← 6 2 r̲eshape n̲umbers ⎕N̲GET "../data/w2.txt" 9x ← 4 3 r̲eshape 0.5 -1.0 0.25 1.0 0.0 -0.5 -0.75 0.5 1.0 0.2 0.4 -0.6 10h ← ᵃᶜr̲elu x ᵃᶜd̲ense w1 11p ← ᵃᶜs̲oftmax h ᵃᶜd̲ense w2 12p 13ᵃᶜr̲owSums p