type PairFoldContract
bendtorch-core@0.1.0.0 · src/tensor/contracts/fold_records.bend:17
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
17
18type PairFoldContract<-left: Shape.Shape, -right: Shape.Shape, -total: F32, -left_word: U32 -> F32, -right_word: U32 -> F32,
19 -result: (Core.Dynamic & Core.Dynamic) & Result<&2, &1, Core.Error, F32>> is Type:
20 PairFoldContract{
21 value: {Fold.pair_value(result) == Some{total} : Maybe<&2, F32>},
22 left_kept: @+other: U32 -> @inside: {Nat.is_lt(U32.to_nat(other), Shape.logical_numel(Shape.dimensions(left))) == True{} : Bool} ->
23 {Fold.left_point(result, other) == Some{left_word(other)} : Maybe<&2, F32>},
24 right_kept: @+other: U32 -> @inside: {Nat.is_lt(U32.to_nat(other), Shape.logical_numel(Shape.dimensions(right))) == True{} : Bool} ->
25 {Fold.right_point(result, other) == Some{right_word(other)} : Maybe<&2, F32>}}