def decoded_indices
bendtorch-core@0.1.0.0 · src/tensor/permutation_mapping.bend:118
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/shape/coordinate_proofs.bend as Coordinates
118def decoded_indices(+shape: Shape.Shape, +index: U32,
119 +inside: {True{} == Nat.is_lt(U32.to_nat(index), Shape.elements(shape)) : Bool}) ->
120 {Shape.indices(Shape.extents(shape), decoded_coordinate(shape, index, inside)) ==
121 Shape.digits(Shape.extents(shape), U32.to_nat(index)) : List<&2, Nat>}:
122 Equal.trans(List<&2, Nat>, Shape.indices(Shape.extents(shape), decoded_coordinate(shape, index, inside)),
123 Shape.digits(Shape.extents(shape), Shape.Fin.value(Shape.numel(Shape.extents(shape)),
124 Coordinates.fin_from(Shape.numel(Shape.extents(shape)), U32.to_nat(index), Coordinates.size_fits(shape, U32.to_nat(index), inside)))),
125 Shape.digits(Shape.extents(shape), U32.to_nat(index)),
126 Coordinates.digits_unflatten(Shape.extents(shape),
127 Coordinates.fin_from(Shape.numel(Shape.extents(shape)), U32.to_nat(index), Coordinates.size_fits(shape, U32.to_nat(index), inside))),
128 Equal.cong(Nat, List<&2, Nat>, value => Shape.digits(Shape.extents(shape), value),
129 Shape.Fin.value(Shape.numel(Shape.extents(shape)),
130 Coordinates.fin_from(Shape.numel(Shape.extents(shape)), U32.to_nat(index), Coordinates.size_fits(shape, U32.to_nat(index), inside))),
131 U32.to_nat(index), Coordinates.fin_from_value(Shape.numel(Shape.extents(shape)), U32.to_nat(index),
132 Coordinates.size_fits(shape, U32.to_nat(index), inside))))