NVIDIA DRIVE OS Linux SDK API Reference

6.0.9 Release
nvmedia_tensormetadata.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2017-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
22 #ifndef NVM_TENSORMETADATA_H
23 #define NVM_TENSORMETADATA_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
46 #define NVMEDIA_TENSOR_MAX_DIMENSIONS (8u)
47 
50 #define NVM_TENSOR_ATTR_DIMENSION_ORDER_NHWC (0x00000001u)
51 
52 #define NVM_TENSOR_ATTR_DIMENSION_ORDER_NCHW (0x00000002u)
53 
54 #define NVM_TENSOR_ATTR_DIMENSION_ORDER_NCxHWx (0x00000003u)
55 
56 #if (NV_IS_SAFETY == 0)
57 
58 #define NVM_TENSOR_ATTR_DATA_TYPE_UINT (0x00000001u)
59 #endif
60 
62 #define NVM_TENSOR_ATTR_DATA_TYPE_INT (0x00000002u)
63 
64 #define NVM_TENSOR_ATTR_DATA_TYPE_FLOAT (0x00000003u)
65 
66 #if (NV_IS_SAFETY == 0)
67 
68 #define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_64 (64U)
69 
70 #define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_32 (32U)
71 #endif /* (NV_IS_SAFETY == 0) */
72 
74 #define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_16 (16U)
75 
76 #define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_8 (8U)
77 
78 #if (NV_IS_SAFETY == 0)
79 
113 #define NVM_TENSOR_NHWC_E_STRIDE_INDEX 0U
114 
122 #define NVM_TENSOR_NHWC_C_STRIDE_INDEX NVM_TENSOR_NHWC_E_STRIDE_INDEX
123 
131 #define NVM_TENSOR_NHWC_W_STRIDE_INDEX 1U
132 
140 #define NVM_TENSOR_NHWC_H_STRIDE_INDEX 2U
141 
149 #define NVM_TENSOR_NHWC_N_STRIDE_INDEX 3U
150 
176 #define NVM_TENSOR_NCHW_E_STRIDE_INDEX 0U
177 
186 #define NVM_TENSOR_NCHW_W_STRIDE_INDEX NVM_TENSOR_NCHW_E_STRIDE_INDEX
187 
195 #define NVM_TENSOR_NCHW_H_STRIDE_INDEX 1U
196 
203 #define NVM_TENSOR_NCHW_C_STRIDE_INDEX 2U
204 
212 #define NVM_TENSOR_NCHW_N_STRIDE_INDEX 3U
213 
241 #define NVM_TENSOR_NCxHWx_E_STRIDE_INDEX 0U
242 
251 #define NVM_TENSOR_NCxHWx_X_STRIDE_INDEX NVM_TENSOR_NCxHWx_E_STRIDE_INDEX
252 
260 #define NVM_TENSOR_NCxHWx_W_STRIDE_INDEX 1U
261 
269 #define NVM_TENSOR_NCxHWx_H_STRIDE_INDEX 2U
270 
278 #define NVM_TENSOR_NCxHWx_Cx_STRIDE_INDEX 3U
279 
287 #define NVM_TENSOR_NCxHWx_N_STRIDE_INDEX 4U
288 
304 #define NVM_TENSOR_NHWC_C_DIMSZ_INDEX 0U
305 
312 #define NVM_TENSOR_NHWC_W_DIMSZ_INDEX 1U
313 
320 #define NVM_TENSOR_NHWC_H_DIMSZ_INDEX 2U
321 
328 #define NVM_TENSOR_NHWC_N_DIMSZ_INDEX 3U
329 
345 #define NVM_TENSOR_NCHW_W_DIMSZ_INDEX 0U
346 
353 #define NVM_TENSOR_NCHW_H_DIMSZ_INDEX 1U
354 
361 #define NVM_TENSOR_NCHW_C_DIMSZ_INDEX 2U
362 
369 #define NVM_TENSOR_NCHW_N_DIMSZ_INDEX 3U
370 
386 #define NVM_TENSOR_NCxHWx_x_DIMSZ_INDEX 0U
387 
394 #define NVM_TENSOR_NCxHWx_W_DIMSZ_INDEX 1U
395 
402 #define NVM_TENSOR_NCxHWx_H_DIMSZ_INDEX 2U
403 
410 #define NVM_TENSOR_NCxHWx_Cx_DIMSZ_INDEX 3U
411 
418 #define NVM_TENSOR_NCxHWx_N_DIMSZ_INDEX 4U
419 
423 #endif /* (NV_IS_SAFETY == 0) */
424 
428 typedef struct {
434  uint32_t dimsNum;
443  uint32_t dimSizes[NVMEDIA_TENSOR_MAX_DIMENSIONS];
447  uint32_t dimstrides[NVMEDIA_TENSOR_MAX_DIMENSIONS];
449  uint32_t dimsOrder;
451  uint32_t bitsPerElement;
453  uint32_t dataType;
455  uint32_t attrib4D_N;
457  uint32_t attrib4D_C;
459  uint32_t attrib4D_H;
461  uint32_t attrib4D_W;
463  uint32_t attrib4D_X;
465 
466 #ifdef __cplusplus
467 } /* extern "C" */
468 #endif
469 
470 #endif /* NVM_TENSORMETADATA_H */
NvMediaTensorMetaData::attrib4D_X
uint32_t attrib4D_X
Holds the tensor attribute X.
Definition: nvmedia_tensormetadata.h:463
NVMEDIA_TENSOR_MAX_DIMENSIONS
#define NVMEDIA_TENSOR_MAX_DIMENSIONS
Defines the maximum number of tensor dimensions.
Definition: nvmedia_tensormetadata.h:46
NvMediaTensorMetaData::attrib4D_C
uint32_t attrib4D_C
Holds the tensor attribute C.
Definition: nvmedia_tensormetadata.h:457
NvMediaTensorMetaData::attrib4D_W
uint32_t attrib4D_W
Holds the tensor attribute W.
Definition: nvmedia_tensormetadata.h:461
NvMediaTensorMetaData::attrib4D_H
uint32_t attrib4D_H
Holds the tensor attribute H.
Definition: nvmedia_tensormetadata.h:459
NvMediaTensorMetaData::dimsOrder
uint32_t dimsOrder
Holds the order of the dimensions.
Definition: nvmedia_tensormetadata.h:449
NvMediaTensorMetaData::bitsPerElement
uint32_t bitsPerElement
Holds the bitsPerElement such as NVM_TENSOR_ATTR_BITS_PER_ELEMENT_8/16.
Definition: nvmedia_tensormetadata.h:451
NvMediaTensorMetaData::dataType
uint32_t dataType
Holds the tensor datatype, such as NVM_TENSOR_ATTR_DATA_TYPE_INT/FLOAT.
Definition: nvmedia_tensormetadata.h:453
NvMediaTensorMetaData::attrib4D_N
uint32_t attrib4D_N
Holds the tensor attribute N.
Definition: nvmedia_tensormetadata.h:455
NvMediaTensorMetaData
Holds the tensor metadata.
Definition: nvmedia_tensormetadata.h:428
NvMediaTensorMetaData::dimsNum
uint32_t dimsNum
Holds the number of valid elements in dimSizes[] and dimstrides[].
Definition: nvmedia_tensormetadata.h:434