IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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:

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: