def allocated_success

bendtorch-core@0.1.0.0 · src/tensor/transform_PROOF.bend:1946

import bendtorch-core@0.1.0.0/src/tensor/transform_PROOF.bend as TransformPROOF
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/transforms.bend as Transforms
import bendtorch-core@0.1.0.0/src/tensor/lifecycle.bend as Lifecycle
import bendtorch-core@0.1.0.0/src/tensor/transform_totality.bend as Totality
import bendtorch-core@0.1.0.0/src/tensor/allocation_spec.bend as AllocationSpec
import bendtorch-core@0.1.0.0/src/tensor/permute_build_proof.bend as PermuteBuild

1946def allocated_success(+input: Shape.Shape, +axes: List<&2, U32>, +plan: Layout.Plan<input, axes>,
1947  allocated: Result<&2, &1, Core.Error, Core.Tensor<Layout.output(input, axes, plan)>>, source: Core.Tensor<input>,
1948  -certificate: AllocationSpec.TensorDone<Layout.output(input, axes, plan), allocated>) ->
1949  Totality.PublicSuccess<input, Transforms.copy_allocated(input, axes, plan, source, allocated)>:
1950  match allocated:
1951    case Fail{error}:
1952      Totality.PublicSuccess{
1953        {\{AllocationSpec.TensorDone: tensor => same =>
1954          Empty.absurd({False{} == True{} : Bool}, Lifecycle.false_true(Equal.cong(Result<&2, &1, Core.Error, Core.Tensor<Layout.output(input, axes, plan)>>, Bool,
1955            Result.is_done(&2, &1, Core.Error, Core.Tensor<Layout.output(input, axes, plan)>), Done{tensor}, Fail{error}, same)))} :
1956              AllocationSpec.TensorDone<Layout.output(input, axes, plan), Fail{error}> -> {False{} == True{} : Bool}}(certificate)}
1957    case Done{target}:
1958      packed_success(input, axes, plan, Transforms.built(input, axes, plan, source, target),
1959        {\{PermuteBuild.Fact: successful => successful} :
1960          PermuteBuild.Fact<{Totality.copy_succeeded(input, axes, plan, Transforms.built(input, axes, plan, source, target)) == True{} : Bool}> ->
1961            {Totality.copy_succeeded(input, axes, plan, Transforms.built(input, axes, plan, source, target)) == True{} : Bool}}(
1962              PermuteBuild.built_success(input, axes, plan, source, target)))

Uses (21)

Used by (1)