def Elements
bendtorch-core@0.1.0.0 · src/tensor/construction_LAWS.bend:43
import bendtorch-core@0.1.0.0/src/tensor/construction_LAWS.bend as ConstructionLAWS
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
43def Elements(-shape: Shape.Shape, +values: List<&2, F32>, -tensor: Core.Tensor<shape>) -> Type:
44 @+index: U32 -> @inside: Shape.LT(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))) ->
45 Core.ObservationChecked(Core.Packed{shape, tensor}, index) &
46 ({Core.checked_observe(shape, tensor, index) == list_element(values, U32.to_nat(index)) : Maybe<&2, F32>} &
47 {Core.observe(shape, tensor, index) == list_element(values, U32.to_nat(index)) : Maybe<&2, F32>})