law codec_flatten_decode
bendtorch-core@0.1.0.0 · src/tensor/transform_LAWS.bend:291
import bendtorch-core@0.1.0.0/src/tensor/transform_LAWS.bend as TransformLAWS
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
291law codec_flatten_decode:
292 for +shape: Shape.Shape
293 for +index: U32
294 for +inside: {True{} == Nat.is_lt(U32.to_nat(index), Shape.elements(shape)) : Bool}
295 {Layout.flatten_words(Shape.dimensions(shape),
296 Layout.reverse_words(Layout.unflatten_words(Layout.reverse_words(Shape.dimensions(shape)), index)), 0) == index : U32}