def copied_point

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

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/word_conversion.bend as Conversion
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_proof.bend as PointwiseProof

59def copied_point(~P: Data, ~map: P -> Nat -> Nat, +plan: P, +input: Shape.Shape, +fill: F32, +ops: List<&2, StorageLaws.Op>,
60  +output: Shape.Shape,
61  -fits: {Lifecycle.logical_length(target(~P, ~map, Shape.logical_numel(Shape.dimensions(output)), plan, input, fill, ops, output)) ==
62    Shape.logical_numel(Shape.dimensions(output)) : Nat},
63  +index: U32, +inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(output))) == True{} : Bool}) ->
64  {Core.dynamic_read_value(Core.read_dynamic(Core.Packed{output,
65    Core.TTensor{target(~P, ~map, Shape.logical_numel(Shape.dimensions(output)), plan, input, fill, ops, output), fits}}, index)) ==
66    Some{Replayed.value(input, fill, ops, U32.from_nat(map(plan, U32.to_nat(index))))} : Maybe<&2, F32>}:
67  +total = Shape.logical_numel(Shape.dimensions(output))
68  +history = writes(~P, ~map, total, plan, input, fill, ops)
69  Equal.trans(Maybe<&2, F32>,
70    Core.dynamic_read_value(Core.read_dynamic(Core.Packed{output, Core.TTensor{Replayed.storage(output, 0.0, history), fits}}, index)),
71    Some{Replayed.value(output, 0.0, history, index)},
72    Some{Replayed.value(input, fill, ops, U32.from_nat(map(plan, U32.to_nat(index))))},
73    PointwiseProof.replayed_point(output, 0.0, history, fits, index, inside),
74    Equal.cong(F32, Maybe<&2, F32>, word => Some{word}, Replayed.value(output, 0.0, history, index),
75      Replayed.value(input, fill, ops, U32.from_nat(map(plan, U32.to_nat(index)))),
76      PointwiseProof.writes_value(~Unit, ~keep, ~P, ~map, ~map, total, Unit{}, plan, input, fill, ops, input, fill, ops, output, index,
77        inside, Conversion.le_reflexive(total))))

Uses (29)

Used by (1)