def allocated_status

bendtorch-core@0.1.0.0 · src/tensor/matmul_PROOF.bend:1639

import bendtorch-core@0.1.0.0/src/tensor/matmul_PROOF.bend as MatmulPROOF
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/matmul.bend as Matrix
import bendtorch-core@0.1.0.0/src/tensor/math_totality.bend as Totality
import bendtorch-core@0.1.0.0/src/tensor/allocation_spec.bend as Allocation
import bendtorch-core@0.1.0.0/src/storage/main.bend as Storage

1639def allocated_status(+left: Shape.Shape, +right: Shape.Shape, +output: Shape.Shape, +inner: Nat, +columns: Nat,
1640  a: Core.Tensor<left>, b: Core.Tensor<right>, result: Result<&2, &1, Core.Error, Core.Tensor<output>>,
1641  -done: Allocation.TensorDone<output, result>) ->
1642  Totality.Status<Matrix.Error, Core.Dynamic & Core.Dynamic & Core.Dynamic, Matrix.parallel_allocated(left, right, output, inner, columns, a, b, result)>:
1643  match result:
1644    case Fail{error}:
1645      Totality.Status{{\{Allocation.TensorDone: tensor => exact =>
1646        Empty.absurd({False{} == True{} : Bool}, Shape.clash(Equal.cong(Result<&2, &1, Core.Error, Core.Tensor<output>>, Bool,
1647          Result.is_done(&2, &1, Core.Error, Core.Tensor<output>), Done{tensor}, Fail{error}, exact)))} :
1648            Allocation.TensorDone<output, Fail{error}> -> {False{} == True{} : Bool}}(done)}
1649    case Done{Core.TTensor{storage, exact}}:
1650      match storage:
1651        case Storage.Empty{}:
1652          Totality.Status{{==}}
1653        case Storage.Owned{+depth, +length, array, balanced, valid}:
1654          output_status(output, inner, columns, depth, length, valid, exact, left, a, right, b)

Uses (18)

Used by (1)