def held_checked
bendtorch-core@0.1.0.0 · src/autograd/gradient.bend:95
import bendtorch-core@0.1.0.0/src/autograd/gradient.bend as Gradient
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
95def held_checked(contribution: Core.Dynamic, +total_shape: Shape.Shape, total: Core.Tensor<total_shape>, same: Bool) -> Outcome:
96 match same:
97 case False{}:
98 Refused{Held{Core.Packed{total_shape, total}}, contribution, ShapeMismatch{}}
99 case True{}:
100 loop(Shape.elements(total_shape), total_shape, 0n, State{contribution, total})