def step_success

bendtorch-core@0.1.0.0 · src/autograd/gradient_PROOF.bend:640

import bendtorch-core@0.1.0.0/src/autograd/gradient_PROOF.bend as GradientPROOF
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/elementwise_totality.bend as Totality
import bendtorch-core@0.1.0.0/src/tensor/elementwise_PROOF.bend as ElementwiseProof
import bendtorch-core@0.1.0.0/src/autograd/gradient.bend as Gradient

640def step_success(+shape: Shape.Shape, +index: U32, state: Gradient.State<shape>,
641  -fits: {Totality.dimensions(state_contribution(shape, state)) == Shape.dimensions(shape) : List<&2, U32>},
642  -inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool}) ->
643  Holds<{step_continued(shape, Gradient.step(shape, index, state)) == True{} : Bool}>:
644  Gradient.State{owner, total} = state
645  contribution_success(shape, index, total, Core.read_dynamic(owner, index),
646    {\{ElementwiseProof.DynamicReadSuccess: successful => successful} : ElementwiseProof.DynamicReadSuccess<owner, index> ->
647      {ElementwiseProof.dynamic_read_succeeded(Core.read_dynamic(owner, index)) == True{} : Bool}}(
648      ElementwiseProof.dynamic_read_success(owner, index,
649        %Equal.sym(List<&2, U32>, Totality.dimensions(owner), Shape.dimensions(shape), fits) :
650          {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(_)) == True{} : Bool}
651        inside)),
652    inside)

Uses (20)

Used by (1)