def cell_spec

bendtorch-core@0.1.0.0 · src/autograd/reduce_parallel_proof.bend:679

import bendtorch-core@0.1.0.0/src/autograd/reduce_parallel_proof.bend as ReduceParallelProof
import Base
import bendtorch-core@0.1.0.0/src/storage/model.bend as Model
import bendtorch-core@0.1.0.0/src/tensor/elementwise_parallel_proof.bend as Parallel
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/autograd/reduce.bend as Reduce

679# What the cell function computes is what CellSpec names.
680def cell_spec(+d: Nat, A: Array<F32>, +rows: List<&2, Shape.Row>, +extents: List<&2, Nat>, +position: Nat, inside: Bool,
681  -observed: Maybe<&2, F32>, -computed: {observed == Some{Pair.fst(F32, Array<F32> & Unit, cell_of(rows, extents, position, A, inside))} : Maybe<&2, F32>},
682  -valid: Model.Balanced(F32, d, A)) ->
683  Parallel.Fact<CellSpec(d, A, rows, extents, position, inside, observed)>:
684  match inside:
685    case False{}:
686      Parallel.Fact{computed}
687    case True{}:
688      Parallel.Fact{{\{FiberRun: words => seen => total => kept =>
689        CellAt{Pair.fst(F32, Array<F32>, Reduce.fiber_of(rows, extents, position, A)),
690          %keep_equal(Reduce.fiber_of(rows, extents, position, A), Unit{}) :
691            {observed == Some{Pair.fst(F32, Array<F32> & Unit, _)} : Maybe<&2, F32>}
692          computed,
693          words, seen, total}} :
694        FiberRun<d, A, visited_of(rows, extents, position), 0.0, Reduce.fiber_of(rows, extents, position, A)> ->
695        CellAt<d, A, rows, extents, position, observed>}(
696        {\{Parallel.Fact: p => p} : Parallel.Fact<FiberRun<d, A, visited_of(rows, extents, position), 0.0, Reduce.fiber_of(rows, extents, position, A)>> ->
697          FiberRun<d, A, visited_of(rows, extents, position), 0.0, Reduce.fiber_of(rows, extents, position, A)>}(
698          run_of(d, A, rows, extents, position, valid)))}

Uses (20)

Used by (1)