def map_inverse
bendtorch-core@0.1.0.0 · src/tensor/layout.bend:371
import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
371def map_inverse(+input: Shape.Shape, +axes: List<&2, U32>, +plan: Plan<input, axes>, +i: U32,
372 oi: FlatIndex<output(input, axes, plan)>, +oc: CheckedCoordinate<output(input, axes, plan)>,
373 requested: {index_value(output(input, axes, plan), oi) == i : U32},
374 decoded: {coordinate_values(output(input, axes, plan), oc) ==
375 reverse_words(unflatten_words(reverse_words(Shape.dimensions(output(input, axes, plan))), i)) : List<&2, U32>},
376 result: Maybe<&2, List<&2, U32>>,
377 same: {result == inverse_coordinates(Shape.dimensions(input), axes,
378 coordinate_values(output(input, axes, plan), oc), 0) : Maybe<&2, List<&2, U32>>}) -> Result<&2, &2, Error, Mapping<input, axes, plan, i>>:
379 match result:
380 case None{}:
381 Fail{MappingError{}}
382 case Some{+words}:
383 map_input(input, axes, plan, i, oi, oc, requested, decoded, words, same,
384 words_check(Shape.dimensions(input), words))