TensorRT 10.4.0

A NonZero layer in a network. More...
#include <NvInfer.h>
A NonZero layer in a network.
This layer gets the positions of elements that are nonzero in the input. For boolean input, "nonzero" means "true". Semantics are similar to ONNX NonZero.
The input may have type kFLOAT, kHALF, kINT32, or kBOOL.
The output is a matrix of type kINT32. For an input with dimensions [L1, L2, ..., Lm], the output has dimensions [m,n], where n is the number of nonzero elements. I.e., each column denotes a mD position.
The columns are lexically ordered. E.g., a column with [3,2,4,7] precedes a column with [3,2,5,6].
Tip: "compress" can be implemented with INonZero+IShuffle+Gather. For example, to compress a tensor x over axis k using mask vector v, use nonzero(v) to compute the subscripts, shuffle with reshape dimensions = [1] to make the subscripts 1D, and then gather with the subscripts.
Copyright © 2024 NVIDIA Corporation
Privacy Policy 
Manage My Privacy 
Do Not Sell or Share My Data 
Terms of Service 
Accessibility 
Corporate Policies 
Product Security 
Contact