Source/Packages

Component.SigmoidWeightedGate

packages/components/src/Component/SigmoidWeightedGate.alpha

181 lines14 declarations6.6 KiBSHA-256 7302f612c9f7

def · lines 150–181

propagateSigmoidGatedProductGatePointwise

Full file
150def propagateSigmoidGatedProductGatePointwise =
151  (lambda erased inputs : Nat .
152    unrestricted up : (family PointwiseExpression StdU32 inputs) .
153    unrestricted gate : (family PointwiseExpression StdU32 inputs) .
154    unrestricted upstream : (family PointwiseExpression StdU32 inputs) .
155    let unrestricted binary =
156      (pointwiseBinary StdU32 inputs)
157      in
158      let unrestricted multiply =
159        (binary PointwiseMultiply)
160        in
161        let unrestricted add =
162          (binary PointwiseAdd)
163          in
164          let unrestricted one =
165            (constructor
166              PointwiseExpression
167              PointwiseConstant
168              StdU32
169              inputs
170              (modelWord32FromNaturalTruncated sigmoidWeightedGateOne))
171            in
172            let unrestricted sigmoid =
173              (sigmoidPointwise inputs gate)
174              in
175              let unrestricted complement =
176                (add one (pointwiseUnary StdU32 inputs PointwiseNegate sigmoid))
177                in
178                let unrestricted slope =
179                  (multiply sigmoid (add one (multiply gate complement)))
180                  in
181                  multiply (multiply upstream up) slope)

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.