def read_after_done
bendtorch-core@0.1.0.0 · src/tensor/read_contract.bend:178
import bendtorch-core@0.1.0.0/src/tensor/read_contract.bend as ReadContract
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
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
178def read_after_done(+shape: Shape.Shape, +fill: F32, -valid: {Lifecycle.logical_length(StorageLaws.created(Shape.count(shape), fill)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat}, +index: U32, +other: U32, inside: {Nat.is_lt(U32.to_nat(other), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool}) ->
179 {Observation.after_value(shape, index, other, Done{Core.TTensor{StorageLaws.created(Shape.count(shape), fill), valid}}) == Some{fill} : Maybe<&2, F32>}:
180 Equal.trans(Maybe<&2, F32>,
181 Observation.after_value_pair(shape, other, Core.read_result(shape, StorageLaws.created(Shape.count(shape), fill), valid, index, Storage.get(StorageLaws.created(Shape.count(shape), fill), index), {==})),
182 Lifecycle.read_value(Storage.get(StorageLaws.kept(StorageLaws.created(Shape.count(shape), fill), index), other)), Some{fill},
183 read_value_projection(shape, StorageLaws.created(Shape.count(shape), fill), valid, index, other, Storage.get(StorageLaws.created(Shape.count(shape), fill), index), {==}),
184 stored_value(StorageLaws.kept(StorageLaws.created(Shape.count(shape), fill), index), other, fill,
185 StorageLaws.replay_get(Shape.count(shape), fill, [StorageLaws.Read{index}], other, Conversion.shape_count_within(shape), word_inside(shape, other, inside))))