def plan_bounded_success
bendtorch-core@0.1.0.0 · src/tensor/permutation_mapping.bend:290
import bendtorch-core@0.1.0.0/src/tensor/permutation_mapping.bend as PermutationMapping
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/storage/arith.bend as Arith
290def plan_bounded_success(+input: Shape.Shape, +axes: List<&2, U32>, decision: Shape.BoolCase<Layout.bounded(axes, Shape.rank(input))>,
291 +valid: {True{} == Layout.bijective(input, axes) : Bool}) ->
292 {Result.is_done(&2, &2, Layout.Error, Layout.Plan<input, axes>, Layout.plan_bounded(input, axes, decision)) == True{} : Bool}:
293 match decision:
294 case Shape.BFalse{equal}:
295 Empty.absurd({False{} == True{} : Bool},
296 Arith.clash(Equal.trans(Bool, False{}, Layout.bounded(axes, Shape.rank(input)), True{}, equal,
297 Equal.sym(Bool, True{}, Layout.bounded(axes, Shape.rank(input)),
298 and_left(Layout.bounded(axes, Shape.rank(input)), Layout.unique(axes),
299 and_right(Nat.is_eq(Shape.rank_dimensions(axes), Shape.rank_dimensions(Shape.dimensions(input))),
300 Bool.and(Layout.bounded(axes, Shape.rank(input)), Layout.unique(axes)), valid))))))
301 case Shape.BTrue{equal}:
302 plan_unique_success(input, axes, Shape.bool_case(Layout.unique(axes)), valid)