def Mapping

bendtorch-core@0.1.0.0 · src/autograd/gradient_LAWS.bend:44

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

44def Mapping(-slot: Gradient.Slot, -contribution: Core.Dynamic, +shape: Shape.Shape, outcome: Gradient.Outcome) -> Type:
45  match outcome:
46    case Gradient.Refused{after, returned, error}:
47      Unit
48    case Gradient.Accumulated{after}:
49      {held_dimensions(after) == Some{Shape.dimensions(shape)} : Maybe<&2, List<&2, U32>>} &
50        (@+index: U32 -> @inside: Inside(shape, index) ->
51          {held_observe(after, index) == combined(slot, contribution, index) : Maybe<&2, F32>})

Uses (15)

Used by (7)