def reset_checked

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

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

862def reset_checked(+shape: Shape.Shape, +contribution_shape: Shape.Shape, tensor: Core.Tensor<contribution_shape>, same: Bool,
863  decided: {same == Layout.words_same(Shape.dimensions(contribution_shape), Shape.dimensions(shape)) : Bool},
864  agrees: {Shape.dimensions(contribution_shape) == Shape.dimensions(shape) : List<&2, U32>}) ->
865  {Gradient.checked(shape, Gradient.Unset{}, contribution_shape, tensor, same) ==
866    Gradient.Accumulated{Gradient.Held{Core.Packed{contribution_shape, tensor}}} : Gradient.Outcome}:
867  match same:
868    case False{}:
869      Empty.absurd({Gradient.checked(shape, Gradient.Unset{}, contribution_shape, tensor, False{}) ==
870        Gradient.Accumulated{Gradient.Held{Core.Packed{contribution_shape, tensor}}} : Gradient.Outcome},
871        Arith.clash(Equal.trans(Bool, False{}, Layout.words_same(Shape.dimensions(contribution_shape), Shape.dimensions(shape)), True{}, decided,
872          %agrees : {Layout.words_same(Shape.dimensions(contribution_shape), _) == True{} : Bool}
873          TransformProof.words_same_refl(Shape.dimensions(contribution_shape)))))
874    case True{}:
875      {==}

Uses (15)

Used by (1)