Fix idx2crd docstring (#2914)

* fix idx2crd docstring

* fix

* fix
This commit is contained in:
Wenxuan Tan
2026-01-07 10:11:38 -08:00
committed by GitHub
parent eb61c91147
commit f86feb0aa8

View File

@@ -2990,9 +2990,11 @@ def idx2crd(idx, shape, *, loc=None, ip=None):
@cute.jit
def foo():
coord = cute.idx2crd(11, (5,4))
# Computed as: 11 = 2 * 4 + 3, so coordinate is (2, 3)
# idx2crd is always col-major
# For shape (m, n, l, ...), coord = (idx % m, idx // m % n, idx // m // n % l, ...
# Computed as: (11 % 5, 11 // 5 % 4) = (1, 2)
print(coord)
foo() # Expected output: (2, 3)
foo() # Expected output: (1, 2)
**Note:**
Python DSL is aligned with C++ DSL.