def ZeroValues

bendtorch-core@0.1.0.0 · src/autograd/reduce_LAWS.bend:89

import bendtorch-core@0.1.0.0/src/autograd/reduce_LAWS.bend as ReduceLAWS
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/reduce.bend as Reduce

89def ZeroValues(+target: Shape.Shape, pair: Core.Dynamic & Result<&2, &1, Reduce.Error, Core.Dynamic>) -> Type:
90  (retained, result) = pair
91  match result:
92    case Fail{error}:
93      Unit
94    case Done{output}:
95      @+index: U32 -> @inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(target))) == True{} : Bool} ->
96        {Core.checked_observe_dynamic(output, index) == Some{0.0} : Maybe<&2, F32>}

Uses (16)

Used by (1)