Mojo function
arg_nonzero
arg_nonzero[type: DType, output_type: DType](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], output_buffer: LayoutTensor[output_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])
Gather the indices of all non-zero elements in input buffer storing the indices in the output_buffer.
Parameters:
- type (
DType
): The element type. - output_type (
DType
): The integer type to store the indices in.
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. - output_buffer (
LayoutTensor[output_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 indices of all non-zero elements.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!