Skip to main content

Mojo function

arg_nonzero_shape

arg_nonzero_shape[type: DType, single_thread_blocking_override: Bool](input_buffer: LayoutTensor[type, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment]) -> IndexList[2]

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

Parameters:

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

Args:

  • input_buffer (LayoutTensor[type, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment]): The tensor to count the non-zeros in.

Returns:

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

Was this page helpful?