def checked_wrong_shape

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

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/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

881def checked_wrong_shape(+shape: Shape.Shape, slot: Gradient.Slot, +contribution_shape: Shape.Shape,
882  tensor: Core.Tensor<contribution_shape>, flag: Bool,
883  decided: {flag == Layout.words_same(Shape.dimensions(contribution_shape), Shape.dimensions(shape)) : Bool},
884  differ: {Shape.dimensions(contribution_shape) != Shape.dimensions(shape) : List<&2, U32>}) ->
885  {Gradient.checked(shape, slot, contribution_shape, tensor, flag) ==
886    Gradient.Refused{slot, Core.Packed{contribution_shape, tensor}, Gradient.ShapeMismatch{}} : Gradient.Outcome}:
887  match flag:
888    case False{}:
889      {==}
890    case True{}:
891      Empty.absurd({Gradient.checked(shape, slot, contribution_shape, tensor, True{}) ==
892        Gradient.Refused{slot, Core.Packed{contribution_shape, tensor}, Gradient.ShapeMismatch{}} : Gradient.Outcome},
893        differ(TransformProof.words_equal(Shape.dimensions(contribution_shape), Shape.dimensions(shape), decided)))

Uses (15)

Used by (1)