0 | module NN.Architectures.Affine
8 | record AffineLayerParams
10 | {auto ac : NewAxisConsistent y [x]}
12 | constructor MkParams
13 | weights : Tensor [y, x] a
17 | affineImpl : {x, y : Axis} ->
18 | NewAxisConsistent y [x] =>
21 | TensorMonoid x.cont => TensorMonoid y.cont =>
22 | DPair (Tensor [x] a) (const (AffineLayerParams x y a)) -> Tensor [y] a
23 | affineImpl (
input ** (MkParams weights bias))
24 | = matrixVectorProduct weights input + bias
27 | affinePara : {x, y : Axis} -> {a : Type} -> Num a =>
28 | NewAxisConsistent y [x] =>
30 | TensorMonoid x.cont => TensorMonoid y.cont =>
31 | Tensor [x] a -\-> Tensor [y] a
33 | (const (AffineLayerParams x y a))