def stored_at
bendtorch-core@0.1.0.0 · src/tensor/index_map.bend:91
import bendtorch-core@0.1.0.0/src/tensor/index_map.bend as IndexMap
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/from_values_contract.bend as FromValues
import bendtorch-core@0.1.0.0/src/tensor/contracts/replayed.bend as Replayed
91def stored_at(+shape: Shape.Shape, +values: List<&2, F32>,
92 +counted: {List.length(&2, F32, values) == Shape.logical_numel(Shape.dimensions(shape)) : Nat},
93 +index: U32, inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool}) ->
94 {Some{Replayed.value(shape, 0.0, FromValues.writes(values, 0n), index)} == List.get(&2, F32, values, U32.to_nat(index)) : Maybe<&2, F32>}:
95 FromValues.written_at(values, 0n, Shape.count(shape), index, 0.0, U32.to_nat(index), FromValues.start_room(shape, values, counted), {==},
96 %Equal.sym(Nat, List.length(&2, F32, values), Shape.logical_numel(Shape.dimensions(shape)), counted) :
97 {Nat.is_lt(U32.to_nat(index), _) == True{} : Bool}
98 inside)