def combined
bendtorch-core@0.1.0.0 · src/autograd/gradient_LAWS.bend:16
import bendtorch-core@0.1.0.0/src/autograd/gradient_LAWS.bend as GradientLAWS
import Base
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
16
17
18
19
20def combined(slot: Gradient.Slot, contribution: Core.Dynamic, +index: U32) -> Maybe<&2, F32>:
21 match slot:
22 case Gradient.Unset{}:
23 Core.checked_observe_dynamic(contribution, index)
24 case Gradient.Held{gradient}:
25 add_word(Core.checked_observe_dynamic(gradient, index), Core.checked_observe_dynamic(contribution, index))