def digits_words
import bendtorch-core@0.1.0.0/src/shape/core.bend as Coreimport Base
409def digits_words(dims: List<&2, U32>, +index: Nat) -> List<&2, Nat>:
410 match dims:
411 case Nil{}:
412 Nil{}
413 case head <> +tail:
414 +stride = numel_words(tail)
415 Nat.div(index, stride) <> digits_words(tail, Nat.mod(index, stride))
Uses (6)
Used by (5)
- bendtorch-core@0.1.0.0/src/tensor/layout:unflatten_words
- bendtorch-core@0.1.0.0/src/tensor/permutation_mapping:codec_decoded
- bendtorch-core@0.1.0.0/src/shape/coordinate_proofs:digits_words_spec
- bendtorch-core@0.1.0.0/src/shape/core:unflatten_checked.finish
- bendtorch-core@0.1.0.0/src/shape/boundary_proofs:unflatten_verdict