def write_lift

bendtorch-core@0.1.0.0 · src/tensor/contracts/replayed.bend:198

import bendtorch-core@0.1.0.0/src/tensor/contracts/replayed.bend as Replayed
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
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

198def write_lift(+shape: Shape.Shape, +fill: F32, +ops: List<&2, StorageLaws.Op>,
199  -valid: {Lifecycle.logical_length(storage(shape, fill, ops)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat},
200  +index: U32, +word: F32,
201  inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool},
202  -P: Core.Tensor<shape> & Result<&2, &2, Core.Error, Unit> -> Type,
203  h: @-fits: {Lifecycle.logical_length(storage(shape, fill, snoc(ops, StorageLaws.Write{index, word}))) == Shape.logical_numel(Shape.dimensions(shape)) : Nat} ->
204    P((Core.TTensor{storage(shape, fill, snoc(ops, StorageLaws.Write{index, word})), fits}, Done{Unit{}}))) ->
205  P(Core.write_flat(shape, Core.TTensor{storage(shape, fill, ops), valid}, index, word)):
206  write_pair_lift(shape, storage(shape, fill, snoc(ops, StorageLaws.Write{index, word})),
207    Core.write_flat(shape, Core.TTensor{storage(shape, fill, ops), valid}, index, word),
208    write_moved(shape, fill, ops, valid, index, word), write_done(shape, fill, ops, valid, index, word, inside), P, h)

Uses (24)

Used by (1)