Layout.Mapping: type of bendtorch-core@0.1.0.0
Import: import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout
Lines 288-301 of bendtorch-core@0.1.0.0/src/tensor/layout.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&start_line=288&end_line=301
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
type Mapping<-input: Shape.Shape, -axes: List<&2, U32>, -plan: Plan , -i: U32> is Data:
Mapped{output_index: FlatIndex,
output_coordinate: CheckedCoordinate,
input_coordinate: CheckedCoordinate , index: FlatIndex ,
requested: {index_value(output(input, axes, plan), output_index) == i : U32},
decoded: {coordinate_values(output(input, axes, plan), output_coordinate) ==
reverse_words(unflatten_words(reverse_words(Shape.dimensions(output(input, axes, plan))), i)) : List<&2, U32>},
inverse: {Some{coordinate_values(input, input_coordinate)} ==
inverse_coordinates(Shape.dimensions(input), axes,
coordinate_values(output(input, axes, plan), output_coordinate), 0) : Maybe<&2, List<&2, U32>>},
flattened: {index_value(input, index) ==
flatten_words(Shape.dimensions(input), coordinate_values(input, input_coordinate), 0) : U32},
roundtrip: {True{} == maybe_same(reorder(coordinate_values(input, input_coordinate), axes),
Some{coordinate_values(output(input, axes, plan), output_coordinate)}) : Bool}}
Uses (18):
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=Shape
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=dimensions
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=CheckedCoordinate
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=FlatIndex
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=Plan
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=coordinate_values
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=flatten_words
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=index_value
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=inverse_coordinates
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=maybe_same
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=output
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=reorder
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=reverse_words
https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=unflatten_words