def kept

bendtorch-core@0.1.0.0 · src/tensor/index_map.bend:79

import bendtorch-core@0.1.0.0/src/tensor/index_map.bend as IndexMap
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
import bendtorch-core@0.1.0.0/src/tensor/contracts/replayed.bend as Replayed
import bendtorch-core@0.1.0.0/src/tensor/contracts/pointwise.bend as Pointwise
import bendtorch-core@0.1.0.0/src/tensor/contracts/pointwise_proof.bend as PointwiseProof

79def kept(~P: Data, ~map: P -> Nat -> Nat, +plan: P, +count: Nat, +input: Shape.Shape, +fill: F32, +ops: List<&2, StorageLaws.Op>,
80  -fits: {Lifecycle.logical_length(source(~P, ~map, plan, input, fill, ops, count)) == Shape.logical_numel(Shape.dimensions(input)) : Nat},
81  +other: U32, inside: {Nat.is_lt(U32.to_nat(other), Shape.logical_numel(Shape.dimensions(input))) == True{} : Bool}) ->
82  {Core.read_value(input, Core.read_flat(input, Core.TTensor{source(~P, ~map, plan, input, fill, ops, count), fits}, other)) ==
83    Some{Replayed.value(input, fill, ops, other)} : Maybe<&2, F32>}:
84  +seen = List.append(&2, StorageLaws.Op, ops, Pointwise.reads(~P, ~map, plan, count))
85  Equal.trans(Maybe<&2, F32>, Core.read_value(input, Core.read_flat(input, Core.TTensor{Replayed.storage(input, fill, seen), fits}, other)),
86    Some{Replayed.value(input, fill, seen, other)}, Some{Replayed.value(input, fill, ops, other)},
87    Replayed.read_found(input, fill, seen, fits, other, inside),
88    Equal.cong(F32, Maybe<&2, F32>, word => Some{word}, Replayed.value(input, fill, seen, other), Replayed.value(input, fill, ops, other),
89      PointwiseProof.value_reads(~P, ~map, plan, count, input, fill, ops, other)))

Uses (25)

Used by (0)

No other definition uses this definition.