def filled_next
bendtorch-core@0.1.0.0 · src/tensor/from_values_contract.bend:260
import bendtorch-core@0.1.0.0/src/tensor/from_values_contract.bend as FromValuesContract
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/storage/LAWS.bend as StorageLaws
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/lifecycle.bend as Lifecycle
260def filled_next(+shape: Shape.Shape, +value: F32, +rest: List<&2, F32>, +cursor: Nat, +prefix: List<&2, StorageLaws.Op>,
261 -P: Result<&2, &1, Core.Error, Core.Tensor<shape>> -> Type, h: Filled(shape, value <> rest, cursor, prefix, P)) ->
262 Filled(shape, rest, 1n+cursor, List.append(&2, StorageLaws.Op, prefix, [StorageLaws.Write{U32.from_nat(cursor), value}]), P):
263 %Equal.sym(Storage.Storage, base(shape, List.append(&2, StorageLaws.Op, prefix, [StorageLaws.Write{U32.from_nat(cursor), value}])),
264 StorageLaws.written(base(shape, prefix), U32.from_nat(cursor), value),
265 replay_snoc(prefix, StorageLaws.Write{U32.from_nat(cursor), value}, StorageLaws.created(Shape.count(shape), 0.0))) :
266 (@-fits: {Lifecycle.logical_length(StorageLaws.replay(writes(rest, 1n+cursor), _)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat} ->
267 P(Done{Core.TTensor{StorageLaws.replay(writes(rest, 1n+cursor), _), fits}}))
268 h