Source/Packages

Component.Linear

packages/components/src/Component/Linear.alpha

147 lines14 declarations5.0 KiBSHA-256 fcdd397cbdab

def · lines 81–131

linearParameters

Full file
The parameters a linear map owns under a path prefix: its weight, and its bias exactly when the map declares one.
81def linearParameters =
82  (lambda unrestricted prefix : (family StdList Bytes) .
83    (lambda unrestricted component : (family LinearComponent) .
84      (eliminate
85        LinearComponent
86        (lambda unrestricted current : (family LinearComponent) .
87          (family StdList (family ParameterSchema)))
88        component
89        (branch
90          LinearComponentOf
91          name
92          inputs
93          outputs
94          bias
95          .
96          (constructor
97            StdList
98            StdListCons
99            (family ParameterSchema)
100            (linearParameterAt
101              (componentPath prefix name b"weight")
102              (constructor
103                StdList
104                StdListCons
105                Nat
106                inputs
107                (constructor StdList StdListCons Nat outputs (constructor StdList StdListEmpty Nat)))
108              (linearWeightStorage inputs outputs))
109            (eliminate
110              StdBool
111              (lambda unrestricted current : (family StdBool) .
112                (family StdList (family ParameterSchema)))
113              bias
114              (branch
115                StdTrue
116                .
117                (constructor
118                  StdList
119                  StdListCons
120                  (family ParameterSchema)
121                  (linearParameterAt
122                    (componentPath prefix name b"bias")
123                    (constructor
124                      StdList
125                      StdListCons
126                      Nat
127                      outputs
128                      (constructor StdList StdListEmpty Nat))
129                    (linearBiasStorage outputs))
130                  (constructor StdList StdListEmpty (family ParameterSchema))))
131              (branch StdFalse . (constructor StdList StdListEmpty (family ParameterSchema)))))))))

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.