type FoldContract
bendtorch-core@0.1.0.0 · src/tensor/contracts/fold_records.bend:7
import bendtorch-core@0.1.0.0/src/tensor/contracts/fold_records.bend as FoldRecords
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/contracts/fold.bend as Fold
7
8
9
10type FoldContract<-input: Shape.Shape, -total: F32, -word: U32 -> F32,
11 -result: Core.Dynamic & Result<&2, &1, Core.Error, F32>> is Type:
12 FoldContract{
13 value: {Fold.value(result) == Some{total} : Maybe<&2, F32>},
14 kept: @+other: U32 -> @inside: {Nat.is_lt(U32.to_nat(other), Shape.logical_numel(Shape.dimensions(input))) == True{} : Bool} ->
15 {Fold.input_point(result, other) == Some{word(other)} : Maybe<&2, F32>}}