def read_lift

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

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

117def read_lift(+shape: Shape.Shape, +fill: F32, +ops: List<&2, StorageLaws.Op>,
118  -valid: {Lifecycle.logical_length(storage(shape, fill, ops)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat}, +index: U32,
119  inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool},
120  -P: Core.Tensor<shape> & Result<&2, &2, Core.Error, F32> -> Type,
121  h: @-fits: {Lifecycle.logical_length(storage(shape, fill, snoc(ops, StorageLaws.Read{index}))) == Shape.logical_numel(Shape.dimensions(shape)) : Nat} ->
122    P((Core.TTensor{storage(shape, fill, snoc(ops, StorageLaws.Read{index})), fits}, Done{value(shape, fill, ops, index)}))) ->
123  P(Core.read_flat(shape, Core.TTensor{storage(shape, fill, ops), valid}, index)):
124  read_pair_lift(shape, storage(shape, fill, snoc(ops, StorageLaws.Read{index})), value(shape, fill, ops, index),
125    Core.read_flat(shape, Core.TTensor{storage(shape, fill, ops), valid}, index),
126    read_moved(shape, fill, ops, valid, index), read_found(shape, fill, ops, valid, index, inside), P, h)

Uses (24)

Used by (3)