mirror of
https://github.com/NVIDIA/cutlass.git
synced 2026-04-19 22:38:56 +00:00
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user