def sum_result_status

bendtorch-core@0.1.0.0 · src/tensor/reduction_PROOF.bend:817

import bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF.bend as ReductionPROOF
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/reduction.bend as Reduction
import bendtorch-core@0.1.0.0/src/tensor/math_totality.bend as Totality
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith

817def sum_result_status(+shape: Shape.Shape, result: Result<&2, &1, Core.Error, Core.Tensor<shape> & F32>,
818  -status: Totality.Status<Core.Error, Core.Tensor<shape> & F32, result>) ->
819  Totality.Status<Core.Error, Core.Tensor<shape> & Core.Tensor<Reduction.scalar_shape()>, Reduction.sum_result(shape, result)>:
820  match result:
821    case Fail{error}:
822      Totality.Status{{\{Totality.Status: successful => Empty.absurd({False{} == True{} : Bool}, Arith.clash(successful))} :
823        Totality.Status<Core.Error, Core.Tensor<shape> & F32, Fail{error}> -> {False{} == True{} : Bool}}(status)}
824    case Done{pair}:
825      (tensor, +value) = pair
826      sum_allocated_status(shape, tensor, value)

Uses (14)

Used by (1)