def cea_exp

bend-ml-tensor-array@0.1.19.0 · main.bend:419

import bend-ml-tensor-array@0.1.19.0/main.bend as BendMlTensorArray
import Base

419# cells idx..idx + k become exp(cell - m); returns their sum from s, added left to right
420def cea_exp(k: Nat, +idx: U32, +m: F32, +s: F32, r: Array<F32> & F32) -> AF:
421  match k r:
422    case 0n Tuple{c, +x}:
423      +e = F32.exp((x - m : F32))
424      AF{Array.set(F32, c, idx, e), (s + e : F32)}
425    case 1n+p Tuple{c, +x}:
426      +e = F32.exp((x - m : F32))
427      cea_exp(p, (idx + 1 : U32), m, (s + e : F32), Array.get(F32, Array.set(F32, c, idx, e), (idx + 1 : U32)))

Uses (13)

Used by (2)