DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

DNNPlugin.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed
3 // under the Mutual Non-Disclosure Agreement.
4 //
5 // Notice
6 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
7 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
8 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
9 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10 //
11 // NVIDIA Corporation assumes no responsibility for the consequences of use of such
12 // information or for any infringement of patents or other rights of third parties that may
13 // result from its use. No license is granted by implication or otherwise under any patent
14 // or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
15 // expressly authorized by NVIDIA. Details are subject to change without notice.
16 // This code supersedes and replaces all information previously supplied.
17 // NVIDIA Corporation products are not authorized for use as critical
18 // components in life support devices or systems without express written approval of
19 // NVIDIA Corporation.
20 //
21 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
22 //
23 // NVIDIA Corporation and its licensors retain all intellectual property and proprietary
24 // rights in and to this software and related documentation and any modifications thereto.
25 // Any use, reproduction, disclosure or distribution of this software and related
26 // documentation without an express license agreement from NVIDIA Corporation is
27 // strictly prohibited.
28 //
30 
38 #ifndef DW_DNN_PLUGIN_H_
39 #define DW_DNN_PLUGIN_H_
40 
51 #include <dw/core/Types.h>
52 #include <dw/dnn/DNN.h>
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
61 typedef enum dwDNNPluginLayout {
72 
76 typedef struct dwDNNPluginWeights
77 {
79  const void* values;
80  int64_t count;
82 
87 typedef void* _dwDNNPluginHandle_t;
88 
97 dwStatus _dwDNNPlugin_initializeFromWeights(_dwDNNPluginHandle_t* handle, const char8_t* layerName,
98  const dwDNNPluginWeights* weights, int32_t numWeights);
99 
108 dwStatus _dwDNNPlugin_initialize(_dwDNNPluginHandle_t* handle, const char8_t* layerName,
109  const void* data, size_t length);
110 
116 dwStatus _dwDNNPlugin_release(_dwDNNPluginHandle_t handle);
117 
124 dwStatus _dwDNNPlugin_getNumOutputs(int32_t* numOutputs, _dwDNNPluginHandle_t handle);
125 
136  int32_t outputIndex, const dwBlobSize* inputDimensions,
137  int32_t numInputs, _dwDNNPluginHandle_t handle);
138 
146 dwStatus _dwDNNPlugin_getWorkspaceSize(size_t* workspaceSize, int32_t maxBatchSize,
147  _dwDNNPluginHandle_t handle);
148 
158  dwDNNPluginLayout pluginLayout, _dwDNNPluginHandle_t handle);
159 
173  int32_t numInputs, const dwBlobSize* outputDimensions,
174  int32_t numOutputs, dwPrecision precision,
175  dwDNNPluginLayout layout, int32_t maxBatchSize,
176  _dwDNNPluginHandle_t handle);
177 
188 dwStatus _dwDNNPlugin_enqueue(int32_t batchSize, const void* const* inputs, void** outputs,
189  void* workspace, cudaStream_t stream, _dwDNNPluginHandle_t handle);
190 
197 dwStatus _dwDNNPlugin_getSerializationSize(size_t* serializationSize, _dwDNNPluginHandle_t handle);
198 
205 dwStatus _dwDNNPlugin_serialize(void* buffer, _dwDNNPluginHandle_t handle);
206 
209 #ifdef __cplusplus
210 }
211 #endif
212 
213 #endif // DW_DNN_PLUGIN_H_
dwStatus _dwDNNPlugin_getSerializationSize(size_t *serializationSize, _dwDNNPluginHandle_t handle)
Returns serialization size.
CHW with 4-element packed channels.
Definition: DNNPlugin.h:68
NVIDIA DriveWorks API: Core Types
dwStatus _dwDNNPlugin_release(_dwDNNPluginHandle_t handle)
Releases the custom plugin.
dwStatus _dwDNNPlugin_configureWithFormat(const dwBlobSize *inputDimensions, int32_t numInputs, const dwBlobSize *outputDimensions, int32_t numOutputs, dwPrecision precision, dwDNNPluginLayout layout, int32_t maxBatchSize, _dwDNNPluginHandle_t handle)
Configures the plugin with given format.
dwPrecision
Definition: Types.h:140
CHW with 32-element packed channels.
Definition: DNNPlugin.h:70
dwDNNPluginLayout
Represents different layouts for plugins.
Definition: DNNPlugin.h:61
dwPrecision precision
data type of the weights
Definition: DNNPlugin.h:78
dwStatus _dwDNNPlugin_initialize(_dwDNNPluginHandle_t *handle, const char8_t *layerName, const void *data, size_t length)
Initializes the custom plugin from serialized bytes.
Holds blob dimensions.
Definition: DNNTypes.h:60
CHW with 2-element packed channels.
Definition: DNNPlugin.h:65
NVIDIA DriveWorks API: DNN Methods
CHW with 16-element packed channels.
Definition: DNNPlugin.h:69
dwStatus
Status definition.
Definition: Status.h:166
HWC with 8-element packed channels. (C must be a multiple of 8)
Definition: DNNPlugin.h:66
dwStatus _dwDNNPlugin_getNumOutputs(int32_t *numOutputs, _dwDNNPluginHandle_t handle)
Returns number of outputs.
HWC with 8-element packed channels. (C must be a multiple of 8)
Definition: DNNPlugin.h:67
CHW with 2-element packed channels.
Definition: DNNPlugin.h:64
dwStatus _dwDNNPlugin_serialize(void *buffer, _dwDNNPluginHandle_t handle)
Serializes the layer.
void * _dwDNNPluginHandle_t
_dwDNNPluginHandle_t can be optionally used for storing and accessing variables among the functions d...
Definition: DNNPlugin.h:87
char char8_t
Definition: Types.h:72
Stores DNN weights.
Definition: DNNPlugin.h:76
dwStatus _dwDNNPlugin_initializeFromWeights(_dwDNNPluginHandle_t *handle, const char8_t *layerName, const dwDNNPluginWeights *weights, int32_t numWeights)
Initializes the custom plugin from weights.
dwStatus _dwDNNPlugin_getWorkspaceSize(size_t *workspaceSize, int32_t maxBatchSize, _dwDNNPluginHandle_t handle)
Returns workspace size.
int64_t count
the number of weights in the array
Definition: DNNPlugin.h:80
dwStatus _dwDNNPlugin_enqueue(int32_t batchSize, const void *const *inputs, void **outputs, void *workspace, cudaStream_t stream, _dwDNNPluginHandle_t handle)
Performs forward-pass.
dwStatus _dwDNNPlugin_getOutputDimensions(dwBlobSize *outputDimensions, int32_t outputIndex, const dwBlobSize *inputDimensions, int32_t numInputs, _dwDNNPluginHandle_t handle)
Returns output dimensions of an output at a given index based on inputDimensions. ...
dwStatus _dwDNNPlugin_supportsFormat(bool *res, dwPrecision precision, dwDNNPluginLayout pluginLayout, _dwDNNPluginHandle_t handle)
Returns a flag indicating whether the given format is supported.
const void * values
the weight values, in a contiguous array
Definition: DNNPlugin.h:79