def point_value

bendtorch-core@0.1.0.0 · src/tensor/construction_contract_PROOF.bend:106

import bendtorch-core@0.1.0.0/src/tensor/construction_contract_PROOF.bend as ConstructionContractPROOF
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/storage/main.bend as Storage
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/allocation_spec.bend as Allocation
import bendtorch-core@0.1.0.0/src/tensor/allocation_PROOF.bend as AllocationProof
import bendtorch-core@0.1.0.0/src/tensor/word_conversion.bend as Conversion
import bendtorch-core@0.1.0.0/src/tensor/observation.bend as Observation

106def point_value(+shape: Shape.Shape, +fill: F32, +index: U32,
107  inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool}) ->
108  {Observation.point(shape, index, Core.new(shape, fill)) == Some{fill} : Maybe<&2, F32>}:
109  result_point(shape, fill, index, Storage.new(Shape.count(shape), fill),
110      Equal.trans(Maybe<&2, Nat>, Allocation.storage_length(Storage.new(Shape.count(shape), fill)),
111        Some{U32.to_nat(Shape.count(shape))}, Some{Shape.elements(shape)},
112        AllocationProof.storage_new(Shape.count(shape), fill, Conversion.shape_count_within(shape)),
113        Equal.cong(Nat, Maybe<&2, Nat>, value => Some{value}, U32.to_nat(Shape.count(shape)), Shape.elements(shape),
114          Conversion.shape_count_exact(shape))),
115    storage_new_value(shape, fill, index, inside))

Uses (23)

Used by (3)