|
Convolutional Neural Networks in APL blog←{⍺×⍵×1-⍵}
backbias←{+/,⍵}
logistic←{÷1+*-⍵}
maxpos←{(,⍵)⍳⌈/,⍵}
backavgpool←{2⌿2/⍵÷4}⍤2
meansqerr←{÷∘2+/,(⍺-⍵)*2}
avgpool←{÷∘4{+/,⍵}⌺(2 2⍴2)⍤2⊢⍵}
conv←{s←1+(⍴⍵)-⍴⍺⋄⊃+/,⍺×(⍳⍴⍺){s↑⍺↓⍵} ⊂⍵}
backin←{(d w in)←⍵⋄⊃+/,w{(⍴in)↑(-⍵+⍴d)↑⍺×d} ⍳⍴w}
multiconv←{(a ws bs)←⍵⋄bs{⍺+⍵ conv a}⍤(0,(⍴⍴a))⊢ws}
https://dl.acm.org/doi/pdf/10.1145/3315454.3329960 |
It is pretty easy to write unmaintainable APL, it seems to me.