Skip to main content

Mojo function

arg_nonzero

arg_nonzero[dtype: DType, output_type: DType](input_buffer: TileTensor[dtype, input_buffer.LayoutType, input_buffer.origin, address_space=input_buffer.address_space, linear_idx_type=input_buffer.linear_idx_type, element_size=input_buffer.element_size], output_buffer: TileTensor[output_type, output_buffer.LayoutType, output_buffer.origin, address_space=output_buffer.address_space, linear_idx_type=output_buffer.linear_idx_type, element_size=output_buffer.element_size])

Gather the indices of all non-zero elements in input buffer storing the indices in the output_buffer.

Parameters:

  • ​dtype (DType): The element dtype.
  • ​output_type (DType): The integer dtype to store the indices in.

Args:

  • ​input_buffer (TileTensor): The tensor to count the non-zeros in.
  • ​output_buffer (TileTensor): The indices of all non-zero elements.

Was this page helpful?