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
argsort
def argsort[*, ascending: Bool = True, target: StringSlice[ImmStaticOrigin] = StringSlice("cpu")](output: TileTensor[Storage=output.Storage, linear_idx_type=output.linear_idx_type], input: TileTensor[Storage=input.Storage, address_space=input.address_space, linear_idx_type=input.linear_idx_type], ctx: DeviceContext)
Performs argsort on input buffer, storing indices in output buffer.
Parameters:
- βascending (
Bool): Sort direction (True for ascending, False for descending). - βtarget (
StringSlice[ImmStaticOrigin]): Target device ("cpu" or "gpu").
Args:
- βoutput (
TileTensor[Storage=output.Storage, linear_idx_type=output.linear_idx_type]): Buffer to store sorted indices. - βinput (
TileTensor[Storage=input.Storage, address_space=input.address_space, linear_idx_type=input.linear_idx_type]): Buffer containing values to sort. - βctx (
DeviceContext): Device context for execution.
def argsort[ascending: Bool = True](output: TileTensor[Storage=output.Storage, linear_idx_type=output.linear_idx_type], input: TileTensor[Storage=input.Storage, address_space=input.address_space, linear_idx_type=input.linear_idx_type])
CPU-only version of argsort.
Parameters:
- βascending (
Bool): Sort direction (True for ascending, False for descending).
Args:
- βoutput (
TileTensor[Storage=output.Storage, linear_idx_type=output.linear_idx_type]): Buffer to store sorted indices. - βinput (
TileTensor[Storage=input.Storage, address_space=input.address_space, linear_idx_type=input.linear_idx_type]): Buffer containing values to sort.