NonZero - version 9#

This page documents version 9 of operator NonZero. See NonZero for the latest version (since version 13).

  • Domain: ai.onnx

  • Since version: 9

Returns the indices of the elements that are non-zero (in row-major order - by dimension). NonZero behaves similar to numpy.nonzero: https://docs.scipy.org/doc/numpy/reference/generated/numpy.nonzero.html, but for scalar input, NonZero produces output shape (0, N) instead of (1, N), which is different from Numpy’s behavior.

Inputs

  • X (T): input

Outputs

  • Y (tensor(int64)): output

Type Constraints

  • T: Constrain to all tensor types. Allowed types: tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8).