Skip to main content
Log in

Mojo function

arg_nonzero_shape

arg_nonzero_shape[type: DType, rank: Int, single_thread_blocking_override: Bool](input_buffer: NDBuffer[type, rank, origin]) -> Index[2]

Return [NumNonZeros, InputRank] where NumNonZeros are the number of non-zero elements in the input.

Parameters:

  • type (DType): The element type.
  • rank (Int): The rank.
  • single_thread_blocking_override (Bool): This op can block.

Args:

  • input_buffer (NDBuffer[type, rank, origin]): The tensor to count the non-zeros in.

Returns:

Shape of the arg_nonzero kernel for this input [NumNonZeros, InputRank].