def parallel_allocated_success

bendtorch-core@0.1.0.0 · src/tensor/elementwise_PROOF.bend:863

import bendtorch-core@0.1.0.0/src/tensor/elementwise_PROOF.bend as ElementwisePROOF
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/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/elementwise.bend as Elementwise
import bendtorch-core@0.1.0.0/src/tensor/elementwise_totality.bend as Totality
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith
import bendtorch-core@0.1.0.0/src/tensor/allocation_spec.bend as Allocation

863def parallel_allocated_success(+operation: Elementwise.Operation, +plan: Shape.BroadcastPlan, left: Core.Dynamic, right: Core.Dynamic,
864  result: Result<&2, &1, Core.Error, Core.Tensor<Shape.output_shape(plan)>>, -done: Allocation.TensorDone<Shape.output_shape(plan), result>) ->
865  Totality.Success<Elementwise.parallel_allocated(operation, plan, left, right, result)>:
866  match result:
867    case Fail{error}:
868      Totality.Success{Empty.absurd({False{} == True{} : Bool},
869        {\{Allocation.TensorDone: tensor => same => Arith.clash(Equal.cong(Result<&2, &1, Core.Error, Core.Tensor<Shape.output_shape(plan)>>, Bool,
870          result => Result.is_done(&2, &1, Core.Error, Core.Tensor<Shape.output_shape(plan)>, result), Fail{error}, Done{tensor},
871          Equal.sym(Result<&2, &1, Core.Error, Core.Tensor<Shape.output_shape(plan)>>, Done{tensor}, Fail{error}, same)))} :
872          Allocation.TensorDone<Shape.output_shape(plan), Fail{error}> -> Empty}(done))}
873    case Done{Core.TTensor{storage, exact}}:
874      match storage:
875        case Storage.Empty{}:
876          Totality.Success{{==}}
877        case Storage.Owned{+depth, +length, array, balanced, valid}:
878          output_success(operation, plan, depth, length, valid, exact, Elementwise.take(left), Elementwise.take(right))

Uses (20)

Used by (2)