def pick_hit

bendtorch-core@0.1.0.0 · src/tensor/write_contract.bend:88

import bendtorch-core@0.1.0.0/src/tensor/write_contract.bend as WriteContract
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith
import bendtorch-core@0.1.0.0/src/tensor/read_contract.bend as Reads

88def pick_hit(+shape: Shape.Shape, +index: U32, +value: F32, +fill: F32, inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool}) ->
89  {written_pick(shape, index, value, index, fill) == value : F32}:
90  %Equal.sym(Bool, Nat.is_lt(U32.to_nat(index), U32.to_nat(Shape.count(shape))), True{}, Reads.word_inside(shape, index, inside)) :
91    {Bool.pick(F32, Bool.and(_, Nat.is_eq(U32.to_nat(index), U32.to_nat(index))), value, fill) == value : F32}
92  %Equal.sym(Bool, Nat.is_eq(U32.to_nat(index), U32.to_nat(index)), True{}, Arith.eq_refl(U32.to_nat(index))) :
93    {Bool.pick(F32, _, value, fill) == value : F32}
94  {==}

Uses (16)

Used by (4)