def plan_selected_success
bendtorch-core@0.1.0.0 · src/tensor/permutation_mapping.bend:243
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
import bendtorch-core@0.1.0.0/src/tensor/axis_spec.bend as Axis
import bendtorch-core@0.1.0.0/src/tensor/axis_algebra.bend as AxisAlgebra
243def plan_selected_success(+input: Shape.Shape, +axes: List<&2, U32>, +valid: {True{} == Layout.bijective(input, axes) : Bool},
244 selected: Maybe<&2, List<&2, U32>>, +same: {selected == Layout.reorder(Shape.dimensions(input), axes) : Maybe<&2, List<&2, U32>>}) ->
245 {Result.is_done(&2, &2, Layout.Error, Layout.Plan<input, axes>, Layout.plan_selected(input, axes, valid, selected, same)) == True{} : Bool}:
246 match selected:
247 case None{}:
248 Empty.absurd({False{} == True{} : Bool},
249 Arith.clash(Equal.cong(Maybe<&2, List<&2, U32>>, Bool, metadata_present, None{},
250 Some{Axis.order(U32, Shape.dimensions(input), Shape.naturals(axes))},
251 Equal.trans(Maybe<&2, List<&2, U32>>, None{}, Layout.reorder(Shape.dimensions(input), axes),
252 Some{Axis.order(U32, Shape.dimensions(input), Shape.naturals(axes))}, same, AxisAlgebra.permutation_complete(input, axes, valid)))))
253 case Some{+dimensions}:
254 plan_built_success(input, axes, dimensions, valid, same, Shape.construct(dimensions),
255 selected_construct_complete(input, axes, dimensions, valid,
256 Equal.cong(Maybe<&2, List<&2, U32>>, List<&2, U32>, Axis.values(U32), Some{dimensions},
257 Some{Axis.order(U32, Shape.dimensions(input), Shape.naturals(axes))},
258 Equal.trans(Maybe<&2, List<&2, U32>>, Some{dimensions}, Layout.reorder(Shape.dimensions(input), axes),
259 Some{Axis.order(U32, Shape.dimensions(input), Shape.naturals(axes))}, same, AxisAlgebra.permutation_complete(input, axes, valid)))),
260 Equal.cong(Maybe<&2, List<&2, U32>>, List<&2, U32>, Axis.values(U32), Some{dimensions},
261 Some{Axis.order(U32, Shape.dimensions(input), Shape.naturals(axes))},
262 Equal.trans(Maybe<&2, List<&2, U32>>, Some{dimensions}, Layout.reorder(Shape.dimensions(input), axes),
263 Some{Axis.order(U32, Shape.dimensions(input), Shape.naturals(axes))}, same, AxisAlgebra.permutation_complete(input, axes, valid))))