\enum TensorFormat \brief Format of the input/output tensors. This enum is used by both plugins and network I/O tensors. \see IPluginV2::supportsFormat(), safe::ICudaEngine::getBindingFormat() For more information about data formats, see the topic "Data Format Description" located in the TensorRT Developer Guide.
| 206 | //! TensorRT Developer Guide. |
| 207 | //! |
| 208 | enum class TensorFormat : int32_t |
| 209 | { |
| 210 | //! Row major linear format. |
| 211 | //! For a tensor with dimensions {N, C, H, W} or {numbers, channels, |
| 212 | //! columns, rows}, the dimensional index corresponds to {3, 2, 1, 0} |
| 213 | //! and thus the order is W minor. |
| 214 | //! |
| 215 | //! For DLA usage, the tensor sizes are limited to C,H,W in the range [1,8192]. |
| 216 | //! |
| 217 | kLINEAR = 0, |
| 218 | |
| 219 | //! Two wide channel vectorized row major format. This format is bound to |
| 220 | //! FP16. It is only available for dimensions >= 3. |
| 221 | //! For a tensor with dimensions {N, C, H, W}, |
| 222 | //! the memory layout is equivalent to a C array with dimensions |
| 223 | //! [N][(C+1)/2][H][W][2], with the tensor coordinates (n, c, h, w) |
| 224 | //! mapping to array subscript [n][c/2][h][w][c%2]. |
| 225 | kCHW2 = 1, |
| 226 | |
| 227 | //! Eight channel format where C is padded to a multiple of 8. This format |
| 228 | //! is bound to FP16. It is only available for dimensions >= 3. |
| 229 | //! For a tensor with dimensions {N, C, H, W}, |
| 230 | //! the memory layout is equivalent to the array with dimensions |
| 231 | //! [N][H][W][(C+7)/8*8], with the tensor coordinates (n, c, h, w) |
| 232 | //! mapping to array subscript [n][h][w][c]. |
| 233 | kHWC8 = 2, |
| 234 | |
| 235 | //! Four wide channel vectorized row major format. This format is bound to |
| 236 | //! INT8 or FP16. It is only available for dimensions >= 3. |
| 237 | //! For INT8, the C dimension must be a build-time constant. |
| 238 | //! For a tensor with dimensions {N, C, H, W}, |
| 239 | //! the memory layout is equivalent to a C array with dimensions |
| 240 | //! [N][(C+3)/4][H][W][4], with the tensor coordinates (n, c, h, w) |
| 241 | //! mapping to array subscript [n][c/4][h][w][c%4]. |
| 242 | //! |
| 243 | //! Deprecated usage: |
| 244 | //! |
| 245 | //! If running on the DLA, this format can be used for acceleration |
| 246 | //! with the caveat that C must be equal or lesser than 4. |
| 247 | //! If used as DLA input and the build option kGPU_FALLBACK is not specified, |
| 248 | //! it needs to meet line stride requirement of DLA format. Column stride in bytes should |
| 249 | //! be a multiple of 32 on Xavier and 64 on Orin. |
| 250 | kCHW4 = 3, |
| 251 | |
| 252 | //! Sixteen wide channel vectorized row major format. This format is bound |
| 253 | //! to FP16. It is only available for dimensions >= 3. |
| 254 | //! For a tensor with dimensions {N, C, H, W}, |
| 255 | //! the memory layout is equivalent to a C array with dimensions |
| 256 | //! [N][(C+15)/16][H][W][16], with the tensor coordinates (n, c, h, w) |
| 257 | //! mapping to array subscript [n][c/16][h][w][c%16]. |
| 258 | //! |
| 259 | //! For DLA usage, this format maps to the native feature format for FP16, |
| 260 | //! and the tensor sizes are limited to C,H,W in the range [1,8192]. |
| 261 | //! |
| 262 | kCHW16 = 4, |
| 263 | |
| 264 | //! Thirty-two wide channel vectorized row major format. This format is |
| 265 | //! only available for dimensions >= 3. |