For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo function
idx2crd
def idx2crd(idx: IntTuple, shape: IntTuple) -> IntTuple
Converts a linear index to a coordinate tuple within a given shape.
This function splits an index into a coordinate within a Shape via a colexicographical enumeration of coordinates in Shape.
Args:
Returns:
IntTuple: A new IntTuple containing the coordinates corresponding to the linear index.
def idx2crd(idx: IntTuple, shape: IntTuple, _stride: IntTuple) -> IntTuple
Converts a linear index to a coordinate tuple within a given shape using custom strides.
Args:
- βidx (
IntTuple): The linear index to convert. - βshape (
IntTuple): The shape of the tensor/array. - β_stride (
IntTuple): Custom strides to use for the conversion.
Returns:
IntTuple: A new IntTuple containing the coordinates corresponding to the linear index.