Source/Packages

Component.SigmoidWeightedGate

packages/components/src/Component/SigmoidWeightedGate.alpha

181 lines14 declarations6.6 KiBSHA-256 7302f612c9f7

def · lines 99–127

sigmoidPointwise

Full file
The elementwise compiler consumes the same binary32 operation tree. These forms are independent of any target and can be fused with surrounding pointwise work. A realization must respect the explicit roundings.
99def sigmoidPointwise =
100  (lambda erased inputs : Nat . unrestricted x : (family PointwiseExpression StdU32 inputs) .
101    let unrestricted unary =
102      (pointwiseUnary StdU32 inputs)
103      in
104      let unrestricted binary =
105        (pointwiseBinary StdU32 inputs)
106        in
107        let unrestricted one =
108          (constructor
109            PointwiseExpression
110            PointwiseConstant
111            StdU32
112            inputs
113            (modelWord32FromNaturalTruncated sigmoidWeightedGateOne))
114          in
115          let unrestricted log2e =
116            (constructor
117              PointwiseExpression
118              PointwiseConstant
119              StdU32
120              inputs
121              (modelWord32FromNaturalTruncated float32Log2E))
122            in
123            then (unary PointwiseReciprocal)
124              (binary PointwiseAdd one)
125              (unary PointwiseExponentialBase2)
126              (binary PointwiseMultiply (unary PointwiseNegate x))
127              log2e)

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.