def reshape_written
bendtorch-core@0.1.0.0 · src/tensor/reshape_contract.bend:169
import bendtorch-core@0.1.0.0/src/tensor/reshape_contract.bend as ReshapeContract
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/read_contract.bend as Reads
import bendtorch-core@0.1.0.0/src/tensor/transform_observation.bend as Observation
import bendtorch-core@0.1.0.0/src/tensor/write_contract.bend as Writes
169def reshape_written(+input: Shape.Shape, +fill: F32, +target: Shape.Shape, +index: U32, +value: F32, +other: U32, -expected: F32,
170 +same: {Shape.logical_numel(Shape.dimensions(input)) == Shape.logical_numel(Shape.dimensions(target)) : Nat}, inside: {Nat.is_lt(U32.to_nat(other), Shape.logical_numel(Shape.dimensions(target))) == True{} : Bool}, picked: {Writes.written_pick(input, index, value, other, fill) == expected : F32}) ->
171 {Observation.reshape_written(input, index, value, Shape.dimensions(target), other, Core.new(input, fill)) == Some{expected} : Maybe<&2, F32>}:
172 Reads.new_lift(input, fill, result => {Observation.reshape_written(input, index, value, Shape.dimensions(target), other, result) == Some{expected} : Maybe<&2, F32>},
173 valid => Equal.trans(Maybe<&2, F32>, Observation.reshape_written(input, index, value, Shape.dimensions(target), other, Done{Core.TTensor{StorageLaws.created(Shape.count(input), fill), valid}}),
174 Some{Writes.written_pick(input, index, value, other, fill)}, Some{expected},
175 written_done(input, fill, target, valid, index, value, other, same, inside),
176 Equal.cong(F32, Maybe<&2, F32>, number => Some{number}, Writes.written_pick(input, index, value, other, fill), expected, picked)))