def mapping_flat_success
bendtorch-core@0.1.0.0 · src/tensor/permutation_mapping.bend:619
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
619def mapping_flat_success(+input: Shape.Shape, +axes: List<&2, U32>, +plan: Layout.Plan<input, axes>, +index: U32,
620 oi: Layout.FlatIndex<Layout.output(input, axes, plan)>, oc: Layout.CheckedCoordinate<Layout.output(input, axes, plan)>, +ic: Layout.CheckedCoordinate<input>,
621 requested: {Layout.index_value(Layout.output(input, axes, plan), oi) == index : U32},
622 decoded: {Layout.coordinate_values(Layout.output(input, axes, plan), oc) == Layout.reverse_words(Layout.unflatten_words(Layout.reverse_words(Shape.dimensions(Layout.output(input, axes, plan))), index)) : List<&2, U32>},
623 inverse: {Some{Layout.coordinate_values(input, ic)} == Layout.inverse_coordinates(Shape.dimensions(input), axes, Layout.coordinate_values(Layout.output(input, axes, plan), oc), 0) : Maybe<&2, List<&2, U32>>},
624 roundtrip: {True{} == Layout.maybe_same(Layout.reorder(Layout.coordinate_values(input, ic), axes), Some{Layout.coordinate_values(Layout.output(input, axes, plan), oc)}) : Bool},
625 +source_index: U32, flat: {source_index == Layout.flatten_words(Shape.dimensions(input), Layout.coordinate_values(input, ic), 0) : U32},
626 decision: Shape.BoolCase<U32.is_lt(source_index, Shape.count(input))>, bounded: {True{} == U32.is_lt(source_index, Shape.count(input)) : Bool}) ->
627 {Result.is_done(&2, &2, Layout.Error, Layout.Mapping<input, axes, plan, index>,
628 Layout.map_flat(input, axes, plan, index, oi, oc, ic, requested, decoded, inverse, roundtrip, source_index, flat, decision)) == True{} : Bool}:
629 match decision:
630 case Shape.BFalse{equal}:
631 Empty.absurd({False{} == True{} : Bool}, Arith.clash(Equal.trans(Bool, False{}, U32.is_lt(source_index, Shape.count(input)), True{}, equal,
632 Equal.sym(Bool, True{}, U32.is_lt(source_index, Shape.count(input)), bounded))))
633 case Shape.BTrue{equal}:
634 {==}