def mapping_output_success

bendtorch-core@0.1.0.0 · src/tensor/permutation_mapping.bend:694

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

694def mapping_output_success(+input: Shape.Shape, +axes: List<&2, U32>, +plan: Layout.Plan<input, axes>, +index: U32,
695  +oi: Layout.FlatIndex<Layout.output(input, axes, plan)>, +requested: {Layout.index_value(Layout.output(input, axes, plan), oi) == index : U32},
696  +values: List<&2, U32>, +decoded: {values == Layout.reverse_words(Layout.unflatten_words(Layout.reverse_words(Shape.dimensions(Layout.output(input, axes, plan))), index)) : List<&2, U32>},
697  checked: Result<&2, &2, Shape.Error, Layout.WordsValid(Shape.dimensions(Layout.output(input, axes, plan)), values)>,
698  successful: {Result.is_done(&2, &2, Shape.Error, Layout.WordsValid(Shape.dimensions(Layout.output(input, axes, plan)), values), checked) == True{} : Bool}) ->
699  {Result.is_done(&2, &2, Layout.Error, Layout.Mapping<input, axes, plan, index>,
700    Layout.map_output(input, axes, plan, index, oi, requested, values, decoded, checked)) == True{} : Bool}:
701  match checked:
702    case Fail{error}:
703      Empty.absurd({False{} == True{} : Bool}, Arith.clash(successful))
704    case Done{+valid}:
705      mapping_inverse_success(input, axes, plan, index, oi, Layout.CWord{values, valid}, requested, decoded,
706        Layout.inverse_coordinates(Shape.dimensions(input), axes, values, 0), {==})

Uses (23)

Used by (1)