DriveWorks SDK Reference
5.12.103 Release
For Test and Development only

Tensor.h
Go to the documentation of this file.
1
2//
3// Notice
4// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
5// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
6// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
7// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8//
9// NVIDIA CORPORATION & AFFILIATES assumes no responsibility for the consequences of use of such
10// information or for any infringement of patents or other rights of third parties that may
11// result from its use. No license is granted by implication or otherwise under any patent
12// or patent rights of NVIDIA CORPORATION & AFFILIATES. No third party distribution is allowed unless
13// expressly authorized by NVIDIA. Details are subject to change without notice.
14// This code supersedes and replaces all information previously supplied.
15// NVIDIA CORPORATION & AFFILIATES products are not authorized for use as critical
16// components in life support devices or systems without express written approval of
17// NVIDIA CORPORATION & AFFILIATES.
18//
19// SPDX-FileCopyrightText: Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
20// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
21//
22// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
23// property and proprietary rights in and to this material, related
24// documentation and any modifications thereto. Any use, reproduction,
25// disclosure or distribution of this material and related documentation
26// without an express license agreement from NVIDIA CORPORATION or
27// its affiliates is strictly prohibited.
28//
30
46#ifndef DW_DNN_TENSOR_H_
47#define DW_DNN_TENSOR_H_
48
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
57typedef struct dwDNNTensorObject* dwDNNTensorHandle_t;
58typedef struct dwDNNTensorObject const* dwConstDNNTensorHandle_t;
59
61#define DW_DNN_TENSOR_MAX_DIMENSIONS 8U
62
64typedef enum {
72
79typedef enum {
89
91typedef enum {
96
98typedef struct
99{
119 uint32_t dimensionSize[DW_DNN_TENSOR_MAX_DIMENSIONS];
123 float32_t dynamicRange[2];
125
127typedef struct
128{
136 const void* ptr;
138
151 dwDNNTensorProperties const* const properties,
152 dwContextHandle_t const ctx);
153
164
185dwStatus dwDNNTensor_getLayoutView(size_t* const offset, size_t* const stride, size_t* const numElements,
186 const uint32_t* const indices, uint32_t const numIndices,
187 uint32_t const dimension, dwConstDNNTensorHandle_t const tensorHandle);
188
199
213
227dwStatus dwDNNTensor_lock(void** const data, dwDNNTensorHandle_t const tensorHandle);
228
244dwStatus dwDNNTensor_tryLock(bool* const isLocked, void** const data, dwDNNTensorHandle_t const tensorHandle);
245
255
256#ifdef __cplusplus
257}
258#endif
260#endif // DW_DNN_TENSOR_H_
NVIDIA DriveWorks API: Core Methods
dwStatus
Status definition.
Definition: ErrorDefs.h:45
float float32_t
Specifies POD types.
Definition: BasicTypes.h:58
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: BasicTypes.h:64
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:86
#define DW_API_PUBLIC
Definition: Exports.h:54
dwTrivialDataType
Specifies a type indicator of the underlying trivial data type.
Definition: Types.h:90
dwTrivialDataType dataType
Data type of elements of the tensor.
Definition: Tensor.h:101
const void * ptr
Pointer to the tensor content on CPU/GPU or NvMedia.
Definition: Tensor.h:136
uint32_t numDimensions
Number of dimensions of the tensor.
Definition: Tensor.h:111
dwTime_t timestamp_us
Specifies a timestamp, in microseconds, corresponding to this tensor data.
Definition: Tensor.h:132
bool isGPUMapped
Indicates whether the memory allocation should be mapped to GPU.
Definition: Tensor.h:109
dwDNNTensorType tensorType
Tensor type.
Definition: Tensor.h:103
dwDNNTensorLayout tensorLayout
Tensor layout.
Definition: Tensor.h:105
dwDNNTensorColorSpace colorSpace
Color space of the data in the tensor.
Definition: Tensor.h:121
dwDNNTensorProperties prop
Defines the properties of the tensor.
Definition: Tensor.h:130
DW_API_PUBLIC dwStatus dwDNNTensor_destroy(dwDNNTensorHandle_t const tensorHandle)
Destroys the tensor handle and frees any memory created by dwDNNTensor_create().
#define DW_DNN_TENSOR_MAX_DIMENSIONS
Maximum number of dimensions a tensor can have including batch dimension (N).
Definition: Tensor.h:61
DW_API_PUBLIC dwStatus dwDNNTensor_unlock(dwDNNTensorHandle_t const tensorHandle)
Unlocks the tensor, enabling other threads to lock the tensor and modify the content.
dwDNNTensorType
Speficies the type of a tensor.
Definition: Tensor.h:64
dwDNNTensorColorSpace
Represents the color space the data is represented in. If unknown, then its custom or non color data.
Definition: Tensor.h:91
struct dwDNNTensorObject * dwDNNTensorHandle_t
Handles representing Deep Neural Network interface.
Definition: Tensor.h:57
DW_API_PUBLIC dwStatus dwDNNTensor_getLayoutView(size_t *const offset, size_t *const stride, size_t *const numElements, const uint32_t *const indices, uint32_t const numIndices, uint32_t const dimension, dwConstDNNTensorHandle_t const tensorHandle)
Returns coefficients to facilitate traversing the given dimension.
dwDNNTensorLayout
Specifies the layout of a tensor Here the letters in the suffix define:
Definition: Tensor.h:79
DW_API_PUBLIC dwStatus dwDNNTensor_getProperties(dwDNNTensorProperties *const properties, dwConstDNNTensorHandle_t const tensorHandle)
Retrieves the properties of a dwDNNTensorHandle_t.
struct dwDNNTensorObject const * dwConstDNNTensorHandle_t
Definition: Tensor.h:58
DW_API_PUBLIC dwStatus dwDNNTensor_lock(void **const data, dwDNNTensorHandle_t const tensorHandle)
Locks the tensor and retrieves pointer to the data with write access.
DW_API_PUBLIC dwStatus dwDNNTensor_create(dwDNNTensorHandle_t *const tensorHandle, dwDNNTensorProperties const *const properties, dwContextHandle_t const ctx)
Creates and allocates resources for a dwDNNTensorHandle_t based on the properties.
DW_API_PUBLIC dwStatus dwDNNTensor_tryLock(bool *const isLocked, void **const data, dwDNNTensorHandle_t const tensorHandle)
Tries to lock the tensor.
DW_API_PUBLIC dwStatus dwDNNTensor_getTensor(dwDNNTensor *const tensor, dwDNNTensorHandle_t const tensorHandle)
Retrieves the dwDNNTensor of a dwDNNTensorHandle_t.
@ DW_DNN_TENSOR_TYPE_NVMEDIA
NvMedia tensor.
Definition: Tensor.h:70
@ DW_DNN_TENSOR_TYPE_CUDA
CUDA tensor.
Definition: Tensor.h:68
@ DW_DNN_TENSOR_TYPE_CPU
CPU tensor.
Definition: Tensor.h:66
@ DW_DNN_TENSOR_COLORSPACE_RGB
Definition: Tensor.h:93
@ DW_DNN_TENSOR_COLORSPACE_UNKNOWN
Definition: Tensor.h:92
@ DW_DNN_TENSOR_COLORSPACE_YUV
Definition: Tensor.h:94
@ DW_DNN_TENSOR_LAYOUT_NHWC
Interleaved tensor.
Definition: Tensor.h:83
@ DW_DNN_TENSOR_LAYOUT_NCHWx
Tensor with both interleaved and planar channels.
Definition: Tensor.h:87
@ DW_DNN_TENSOR_LAYOUT_NCHW
Planar tensor. This is the most common tensor layout.
Definition: Tensor.h:81
Exposes the content of a dwDNNTensorHandle_t.
Definition: Tensor.h:128
Specifies DNNTensor properties.
Definition: Tensor.h:99