type FiberContract

bendtorch-core@0.1.0.0 · src/autograd/reduce_fold_LAWS.bend:13

import bendtorch-core@0.1.0.0/src/autograd/reduce_fold_LAWS.bend as ReduceFoldLAWS
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

13# What a reduce cell promises, stated only through the result: it gives
14# `expected`, and the returned contribution still holds every word.
15type FiberContract<-input: Shape.Shape, -expected: Maybe<&2, F32>, -word: U32 -> F32,
16  -result: Core.Dynamic & Result<&2, &1, Core.Error, F32>> is Type:
17  FiberContract{
18    value: {Fold.value(result) == expected : Maybe<&2, F32>},
19    kept: @+other: U32 -> @inside: {Nat.is_lt(U32.to_nat(other), Shape.logical_numel(Shape.dimensions(input))) == True{} : Bool} ->
20      {Fold.input_point(result, other) == Some{word(other)} : Maybe<&2, F32>}}

Uses (15)

Used by (3)