def count_decision
bendtorch-core@0.1.0.0 · src/tensor/core_PROOF.bend:62
import bendtorch-core@0.1.0.0/src/tensor/core_PROOF.bend as CorePROOF
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/lifecycle.bend as Lifecycle
62def count_decision(+shape: Shape.Shape, +values: List<&2, F32>,
63 decision: Shape.BoolCase<Nat.is_eq(List.length(&2, F32, values), Shape.elements(shape))>) ->
64 Core.ValuesCount(shape, values, Core.from_values_counted(shape, values, decision)):
65 match decision:
66 case Shape.BFalse{equal}:
67 Unit{}
68 case Shape.BTrue{equal}:
69 count_outcome(shape, values,
70 Equal.trans(Nat, Shape.logical_numel(Shape.dimensions(shape)), Shape.elements(shape), List.length(&2, F32, values),
71 Equal.sym(Nat, Shape.elements(shape), Shape.logical_numel(Shape.dimensions(shape)), Shape.elements_exact(shape)),
72 Equal.sym(Nat, List.length(&2, F32, values), Shape.elements(shape),
73 Lifecycle.natural_equal(List.length(&2, F32, values), Shape.elements(shape), equal))),
74 Core.from_values_new(shape, values, Core.new(shape, 0.0)))