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 non-zero in the input. For boolean input, "non-zero" 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 non-zero elements. I.e., each column denotes a m-D 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