def checked_mapping

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

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/autograd/gradient.bend as Gradient
import bendtorch-core@0.1.0.0/src/autograd/gradient_LAWS.bend as Laws

578def checked_mapping(+shape: Shape.Shape, slot: Gradient.Slot, +contribution_shape: Shape.Shape, tensor: Core.Tensor<contribution_shape>, same: Bool,
579  -decided: {same == Layout.words_same(Shape.dimensions(contribution_shape), Shape.dimensions(shape)) : Bool}) ->
580  Holds<Laws.Mapping(slot, Core.Packed{contribution_shape, tensor}, shape, Gradient.checked(shape, slot, contribution_shape, tensor, same))>:
581  match same:
582    case False{}:
583      Holds{Unit{}}
584    case True{}:
585      agreed_mapping(shape, slot, Core.Packed{contribution_shape, tensor},
586        {\{Holds: proof => proof} : Holds<{Shape.dimensions(contribution_shape) == Shape.dimensions(shape) : List<&2, U32>}> ->
587          {Shape.dimensions(contribution_shape) == Shape.dimensions(shape) : List<&2, U32>}}(words_dimensions(contribution_shape, shape, decided)))

Uses (15)

Used by (1)