def checked_success

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

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/storage/arith.bend as Arith
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout
import bendtorch-core@0.1.0.0/src/tensor/transform_PROOF.bend as TransformProof
import bendtorch-core@0.1.0.0/src/autograd/gradient.bend as Gradient
import bendtorch-core@0.1.0.0/src/autograd/gradient_LAWS.bend as Laws

765def checked_success(+shape: Shape.Shape, slot: Gradient.Slot, +contribution_shape: Shape.Shape, tensor: Core.Tensor<contribution_shape>, same: Bool,
766  -decided: {same == Layout.words_same(Shape.dimensions(contribution_shape), Shape.dimensions(shape)) : Bool},
767  -fits: Laws.Fits(shape, slot),
768  -agrees: {Shape.dimensions(contribution_shape) == Shape.dimensions(shape) : List<&2, U32>}) ->
769  Laws.Success<Gradient.checked(shape, slot, contribution_shape, tensor, same)>:
770  match same:
771    case False{}:
772      Laws.Success{Empty.absurd({False{} == True{} : Bool},
773        Arith.clash(Equal.trans(Bool, False{}, Layout.words_same(Shape.dimensions(contribution_shape), Shape.dimensions(shape)), True{}, decided,
774          %agrees : {Layout.words_same(Shape.dimensions(contribution_shape), _) == True{} : Bool}
775          TransformProof.words_same_refl(Shape.dimensions(contribution_shape)))))}
776    case True{}:
777      agreed_success(shape, slot, Core.Packed{contribution_shape, tensor}, fits, agrees)

Uses (17)

Used by (1)