def write_status_projection

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

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/main.bend as Storage
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

137def write_status_projection(-shape: Shape.Shape, -original: Storage.Storage,
138  -valid: {Lifecycle.logical_length(original) == Shape.logical_numel(Shape.dimensions(shape)) : Nat}, +index: U32, +word: F32,
139  pair: Storage.Storage & Result<&2, &2, Storage.Error, Unit>,
140  -same: {pair == Storage.set(original, index, word) : Storage.Storage & Result<&2, &2, Storage.Error, Unit>}) ->
141  {write_status(shape, Core.write_result(shape, original, valid, index, word, pair, same)) ==
142    Result.is_done(&2, &2, Storage.Error, Unit, StorageLaws.outcome(Result<&2, &2, Storage.Error, Unit>, pair)) : Bool}:
143  (storage, result) = pair
144  match result:
145    case Fail{error}:
146      {==}
147    case Done{unit}:
148      {==}

Uses (19)

Used by (1)