NonZero

Versioned name: NonZero-3

Category: Condition operation

Short description: NonZero returns the indices of the non-zero elements of the input tensor.

Detailed description: NonZero returns the indices of the non-zero elements of the input tensor (in row-major order - by dimension). The output tensor has shape [rank(input), num_non_zero]. For example, for the tensor [[1, 0], [1, 1]] the output will be [[0, 1, 1], [0, 0, 1]].

Attributes

Inputs:

Outputs:

Types

Example

<layer ... type="NonZero">
<data output_type="i64"/>
<input>
<port id="0">
<dim>3</dim>
<dim>10</dim>
<dim>100</dim>
<dim>200</dim>
</port>
</input>
<output>
<port id="1">
<dim>4</dim>
<dim>600000</dim>
</port>
</output>
</layer>