def read_moved

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

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/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

67def read_moved(+shape: Shape.Shape, +fill: F32, +ops: List<&2, StorageLaws.Op>,
68  -valid: {Lifecycle.logical_length(storage(shape, fill, ops)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat}, +index: U32) ->
69  {read_stored(shape, Core.read_flat(shape, Core.TTensor{storage(shape, fill, ops), valid}, index)) ==
70    storage(shape, fill, snoc(ops, StorageLaws.Read{index})) : Storage.Storage}:
71  Equal.trans(Storage.Storage, read_stored(shape, Core.read_flat(shape, Core.TTensor{storage(shape, fill, ops), valid}, index)),
72    StorageLaws.kept(storage(shape, fill, ops), index), storage(shape, fill, snoc(ops, StorageLaws.Read{index})),
73    read_owner_projection(shape, storage(shape, fill, ops), valid, index, Storage.get(storage(shape, fill, ops), index), {==}),
74    Equal.sym(Storage.Storage, storage(shape, fill, snoc(ops, StorageLaws.Read{index})), StorageLaws.kept(storage(shape, fill, ops), index),
75      replay_snoc(ops, StorageLaws.Read{index}, shape, fill)))

Uses (21)

Used by (1)