def clone_write

bendtorch-core@0.1.0.0 · src/tensor/clone_contract.bend:178

import bendtorch-core@0.1.0.0/src/tensor/clone_contract.bend as CloneContract
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/observation.bend as Observation
import bendtorch-core@0.1.0.0/src/tensor/read_contract.bend as Reads
import bendtorch-core@0.1.0.0/src/tensor/write_contract.bend as Writes
import bendtorch-core@0.1.0.0/src/tensor/clone_metadata_records.bend as Laws

178def clone_write(+shape: Shape.Shape, +fill: F32, +index: U32, +value: F32,
179  inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool}) -> Laws.CloneWrite<shape, fill, index, value>:
180  +inside = inside
181  Laws.CloneWrite{
182    clone_written(shape, fill, index, value, index, value, inside, Writes.pick_hit(shape, index, value, fill, inside)),
183    other => inside_other => different =>
184      clone_written(shape, fill, index, value, other, fill, inside_other, Writes.pick_frame(shape, index, value, other, fill, inside, different)),
185    other => inside_other => Reads.new_lift(shape, fill, result => {Observation.clone_written_second(shape, index, value, other, result) == Some{fill} : Maybe<&2, F32>},
186      valid => second_written_done(shape, fill, valid, index, value, other, inside_other))}

Uses (16)

Used by (1)