Provides an interface for supporting non-standard DNN layers.
Data Structures | |
| struct | dwDNNCustomLayer |
| Specifies plugin configuration. More... | |
| struct | dwDNNPluginConfiguration |
| Specified plugin configuration. More... | |
| struct | dwDNNPluginField |
| DNN plugin field. More... | |
| struct | dwDNNPluginFieldCollection |
| DNN plugin field colleciton. More... | |
| struct | dwDNNPluginTensorDesc |
| DNN Plugin tensor descriptor. More... | |
| struct | dwDNNPluginWeights |
| Stores DNN weights. More... | |
Typedefs | |
| typedef void const * | _dwConstDNNPluginHandle_t |
| typedef void * | _dwDNNPluginHandle_t |
| _dwDNNPluginHandle_t can be optionally used for storing and accessing variables among the functions defined below. More... | |
Functions | |
| dwStatus | _dwDNNPlugin_canBroadcastInputAcrossBatch (bool *canBroadcastInputAcrossBatch, int32_t inputIndex, _dwConstDNNPluginHandle_t handle) |
| Returns whether plugin can use input that is broadcast across batch without replication. More... | |
| dwStatus | _dwDNNPlugin_clone (_dwDNNPluginHandle_t *out, _dwDNNPluginHandle_t handle) |
| Clones the plugin. More... | |
| dwStatus | _dwDNNPlugin_configurePlugin (const dwDNNPluginTensorDesc *inputDescs, int32_t numInputs, const dwDNNPluginTensorDesc *outputDescs, int32_t numOutputs, _dwDNNPluginHandle_t handle) |
| Configures the plugin with given format. More... | |
| 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. More... | |
| dwStatus | _dwDNNPlugin_create (_dwDNNPluginHandle_t *handle) |
| Creates a custom plugin. More... | |
| dwStatus | _dwDNNPlugin_deserializeFromBuffer (const char8_t *name, const void *buffer, size_t len, _dwDNNPluginHandle_t handle) |
| Deserializes plugin from buffer. More... | |
| dwStatus | _dwDNNPlugin_deserializeFromFieldCollection (const char8_t *name, const dwDNNPluginFieldCollection *fieldCollection, _dwDNNPluginHandle_t handle) |
| Deserializes plugin from field collection. More... | |
| dwStatus | _dwDNNPlugin_deserializeFromWeights (const dwDNNPluginWeights *weights, int32_t numWeights, _dwDNNPluginHandle_t handle) |
| Deserializes plugin from weights. More... | |
| dwStatus | _dwDNNPlugin_destroy (_dwDNNPluginHandle_t handle) |
| Destroys the plugin. More... | |
| dwStatus | _dwDNNPlugin_enqueue (int32_t batchSize, const void *const *inputs, void **outputs, void *workspace, cudaStream_t stream, _dwDNNPluginHandle_t handle) |
| Performs forward-pass. More... | |
| dwStatus | _dwDNNPlugin_getNumOutputs (int32_t *numOutputs, _dwDNNPluginHandle_t handle) |
| Returns number of outputs. More... | |
| 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. More... | |
| dwStatus | _dwDNNPlugin_getOutputPrecision (dwPrecision *outputPrecision, int32_t outputIndex, const dwPrecision *inputPrecisions, int32_t numInputs, _dwConstDNNPluginHandle_t handle) |
| Returns output precision at given index given the input precisions. More... | |
| dwStatus | _dwDNNPlugin_getPluginFieldCollection (dwDNNPluginFieldCollection *fieldCollection, _dwDNNPluginHandle_t handle) |
| Returns a list of fields that needs to be passed to plugin at creation. More... | |
| dwStatus | _dwDNNPlugin_getPluginNamespace (const char8_t **pluginNamespace, _dwConstDNNPluginHandle_t handle) |
| Returns plugin namespace. More... | |
| dwStatus | _dwDNNPlugin_getPluginType (const char8_t **pluginType, _dwConstDNNPluginHandle_t handle) |
| Returns the plugin type as string. More... | |
| dwStatus | _dwDNNPlugin_getPluginVersion (const char8_t **pluginVersion, _dwConstDNNPluginHandle_t handle) |
| Returns plugin version as string. More... | |
| dwStatus | _dwDNNPlugin_getSerializationSize (size_t *serializationSize, _dwDNNPluginHandle_t handle) |
| Returns serialization size. More... | |
| dwStatus | _dwDNNPlugin_getWorkspaceSize (size_t *workspaceSize, int32_t maxBatchSize, _dwDNNPluginHandle_t handle) |
| Returns workspace size. More... | |
| dwStatus | _dwDNNPlugin_initialize (_dwDNNPluginHandle_t *handle, const char8_t *layerName, const void *data, size_t length) |
| Initializes the custom plugin from serialized bytes. More... | |
| dwStatus | _dwDNNPlugin_initializeFromWeights (_dwDNNPluginHandle_t *handle, const char8_t *layerName, const dwDNNPluginWeights *weights, int32_t numWeights) |
| Initializes the custom plugin from weights. More... | |
| dwStatus | _dwDNNPlugin_isOutputBroadcastAcrossBatch (bool *isOutputBroadcastAcrossBatch, int32_t outputIndex, const bool *inputIsBroadcasted, int32_t numInputs, _dwConstDNNPluginHandle_t handle) |
| Returns whether output is broadcast across batch. More... | |
| dwStatus | _dwDNNPlugin_release (_dwDNNPluginHandle_t handle) |
| Releases the custom plugin. More... | |
| dwStatus | _dwDNNPlugin_serialize (void *buffer, _dwDNNPluginHandle_t handle) |
| Serializes the plugin to buffer. More... | |
| dwStatus | _dwDNNPlugin_setPluginNamespace (const char8_t *pluginNamespace, _dwDNNPluginHandle_t handle) |
| Sets plugin namespace. More... | |
| dwStatus | _dwDNNPlugin_setup (_dwDNNPluginHandle_t handle) |
| Initializes the created plugin. More... | |
| dwStatus | _dwDNNPlugin_supportsFormat (bool *res, dwPrecision precision, dwDNNPluginLayout pluginLayout, _dwDNNPluginHandle_t handle) |
| Returns a flag indicating whether the given format is supported. More... | |
| dwStatus | _dwDNNPlugin_supportsFormatCombination (bool *res, int32_t index, const dwDNNPluginTensorDesc *inOut, int32_t numInputs, int32_t numOutputs, _dwConstDNNPluginHandle_t handle) |
| Returns a flag indicating whether the given format is supported. More... | |
| dwStatus | _dwDNNPlugin_terminate (_dwDNNPluginHandle_t handle) |
| Terminates the plugin. More... | |
| struct dwDNNCustomLayer |
| struct dwDNNPluginConfiguration |
| Data Fields | ||
|---|---|---|
| const dwDNNCustomLayer * | customLayers | Array of custom layers. |
| size_t | numCustomLayers | Number of custom layers. |
| struct dwDNNPluginField |
| Data Fields | ||
|---|---|---|
| const void * | data | Plugin field attribute data. |
| int32_t | length | Number of data entries in the plugin attribute. |
| const char8_t * | name | Plugin field attribute name. |
| dwDNNPluginFieldType | type | Plugin fild attribute type. |
| struct dwDNNPluginFieldCollection |
| Data Fields | ||
|---|---|---|
| const dwDNNPluginField * | fields | Pointer to dwDNNPluginField entries. |
| int32_t | numFields | Number of dwDNNPluginField entries. |
| struct dwDNNPluginTensorDesc |
| Data Fields | ||
|---|---|---|
| dwBlobSize | dims | Tensor dimensions. |
| dwDNNPluginLayout | layout | Tensor layout. |
| dwPrecision | precision | Tensor precision. |
| float32_t | scale | Tensor scale. |
| struct dwDNNPluginWeights |
| Data Fields | ||
|---|---|---|
| int64_t | count | the number of weights in the array |
| dwPrecision | precision | data type of the weights |
| const void * | values | the weight values, in a contiguous array |
| typedef void const* _dwConstDNNPluginHandle_t |
Definition at line 156 of file DNNPlugin.h.
| typedef void* _dwDNNPluginHandle_t |
_dwDNNPluginHandle_t can be optionally used for storing and accessing variables among the functions defined below.
Definition at line 155 of file DNNPlugin.h.
| enum dwDNNPluginFieldType |
Plugin field type.
Equivalent to PluginFieldType in TensorRT
| Enumerator | |
|---|---|
| DW_DNN_PLUGIN_FIELD_TYPE_FLOAT16 | FP16 field type. |
| DW_DNN_PLUGIN_FIELD_TYPE_FLOAT32 | FP32 field type. |
| DW_DNN_PLUGIN_FIELD_TYPE_FLOAT64 | FP64 field type. |
| DW_DNN_PLUGIN_FIELD_TYPE_INT8 | INT8 field type. |
| DW_DNN_PLUGIN_FIELD_TYPE_INT16 | INT16 field type. |
| DW_DNN_PLUGIN_FIELD_TYPE_INT32 | INT32 field type. |
| DW_DNN_PLUGIN_FIELD_TYPE_CHAR | char field type. |
| DW_DNN_PLUGIN_FIELD_TYPE_DIMS | dwBlobSize field type. |
| DW_DNN_PLUGIN_FIELD_TYPE_UNKNOWN | Unknown field type. |
Definition at line 104 of file DNNPlugin.h.
| enum dwDNNPluginLayout |
Represents different layouts for plugins.
Definition at line 74 of file DNNPlugin.h.
| dwStatus _dwDNNPlugin_canBroadcastInputAcrossBatch | ( | bool * | canBroadcastInputAcrossBatch, |
| int32_t | inputIndex, | ||
| _dwConstDNNPluginHandle_t | handle | ||
| ) |
Returns whether plugin can use input that is broadcast across batch without replication.
| [out] | canBroadcastInputAcrossBatch | Flag indicating whether plugin can use input that is broadcast across batch without replication |
| [in] | inputIndex | Index of input that could be broadcast |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_clone | ( | _dwDNNPluginHandle_t * | out, |
| _dwDNNPluginHandle_t | handle | ||
| ) |
Clones the plugin.
Note that shallow copy is sufficient.
| [out] | out | Pointer to the clone. |
| [in] | handle | Pointer to a DNN plugin object. |
| dwStatus _dwDNNPlugin_configurePlugin | ( | const dwDNNPluginTensorDesc * | inputDescs, |
| int32_t | numInputs, | ||
| const dwDNNPluginTensorDesc * | outputDescs, | ||
| int32_t | numOutputs, | ||
| _dwDNNPluginHandle_t | handle | ||
| ) |
Configures the plugin with given format.
| [in] | inputDescs | Array of input tensor descriptors |
| [in] | numInputs | Number of inputs |
| [in] | outputDescs | Array of output tensor descriptors |
| [in] | numOutputs | Number of outputs |
| [in] | handle | Pointer to a DNN plugin object |
| 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.
| [in] | inputDimensions | Array of input dimensions |
| [in] | numInputs | Number of inputs |
| [in] | outputDimensions | Array of output dimensions |
| [in] | numOutputs | Number of outputs |
| [in] | precision | Precision |
| [in] | layout | Layout |
| [in] | maxBatchSize | Maximum batch size |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_create | ( | _dwDNNPluginHandle_t * | handle | ) |
Creates a custom plugin.
| [out] | handle | Pointer to a DNN plugin object. |
| dwStatus _dwDNNPlugin_deserializeFromBuffer | ( | const char8_t * | name, |
| const void * | buffer, | ||
| size_t | len, | ||
| _dwDNNPluginHandle_t | handle | ||
| ) |
Deserializes plugin from buffer.
| [in] | name | Name of the plugin. |
| [in] | buffer | Buffer to deserialize plugin from. |
| [in] | len | Size of the buffer in bytes. |
| [in] | handle | Pointer to a DNN plugin object. |
| dwStatus _dwDNNPlugin_deserializeFromFieldCollection | ( | const char8_t * | name, |
| const dwDNNPluginFieldCollection * | fieldCollection, | ||
| _dwDNNPluginHandle_t | handle | ||
| ) |
Deserializes plugin from field collection.
| [in] | name | Name of the plugin. |
| [in] | fieldCollection | Field collection |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_deserializeFromWeights | ( | const dwDNNPluginWeights * | weights, |
| int32_t | numWeights, | ||
| _dwDNNPluginHandle_t | handle | ||
| ) |
Deserializes plugin from weights.
This is only required if the raw model is CAFFE.
| [in] | weights | List of weights |
| [in] | numWeights | Number of weights |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_destroy | ( | _dwDNNPluginHandle_t | handle | ) |
Destroys the plugin.
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_enqueue | ( | int32_t | batchSize, |
| const void *const * | inputs, | ||
| void ** | outputs, | ||
| void * | workspace, | ||
| cudaStream_t | stream, | ||
| _dwDNNPluginHandle_t | handle | ||
| ) |
Performs forward-pass.
| [in] | batchSize | Batch size |
| [in] | inputs | Array of inputs |
| [in] | outputs | Array of outputs |
| [in] | workspace | Pointer to workspace |
| [in] | stream | CUDA stream |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_getNumOutputs | ( | int32_t * | numOutputs, |
| _dwDNNPluginHandle_t | handle | ||
| ) |
Returns number of outputs.
| [out] | numOutputs | Number of outputs |
| [in] | handle | Pointer to a DNN plugin object |
| 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.
| [out] | outputDimensions | Output dimensions |
| [in] | outputIndex | Output index |
| [in] | inputDimensions | Array of input dimensions |
| [in] | numInputs | Number of inputs |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_getOutputPrecision | ( | dwPrecision * | outputPrecision, |
| int32_t | outputIndex, | ||
| const dwPrecision * | inputPrecisions, | ||
| int32_t | numInputs, | ||
| _dwConstDNNPluginHandle_t | handle | ||
| ) |
Returns output precision at given index given the input precisions.
| [out] | outputPrecision | Output precision |
| [in] | outputIndex | Output index |
| [in] | inputPrecisions | List of input precisions |
| [in] | numInputs | Number of inputs |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_getPluginFieldCollection | ( | dwDNNPluginFieldCollection * | fieldCollection, |
| _dwDNNPluginHandle_t | handle | ||
| ) |
Returns a list of fields that needs to be passed to plugin at creation.
| [out] | fieldCollection | Field collection |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_getPluginNamespace | ( | const char8_t ** | pluginNamespace, |
| _dwConstDNNPluginHandle_t | handle | ||
| ) |
Returns plugin namespace.
| [out] | pluginNamespace | Plugin namespace |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_getPluginType | ( | const char8_t ** | pluginType, |
| _dwConstDNNPluginHandle_t | handle | ||
| ) |
Returns the plugin type as string.
| [out] | pluginType | Plugin type |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_getPluginVersion | ( | const char8_t ** | pluginVersion, |
| _dwConstDNNPluginHandle_t | handle | ||
| ) |
Returns plugin version as string.
| [out] | pluginVersion | Plugin version |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_getSerializationSize | ( | size_t * | serializationSize, |
| _dwDNNPluginHandle_t | handle | ||
| ) |
Returns serialization size.
| [out] | serializationSize | Serialization size |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_getWorkspaceSize | ( | size_t * | workspaceSize, |
| int32_t | maxBatchSize, | ||
| _dwDNNPluginHandle_t | handle | ||
| ) |
Returns workspace size.
| [out] | workspaceSize | Workspace size |
| [in] | maxBatchSize | Maximum batch size |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_initialize | ( | _dwDNNPluginHandle_t * | handle, |
| const char8_t * | layerName, | ||
| const void * | data, | ||
| size_t | length | ||
| ) |
Initializes the custom plugin from serialized bytes.
| [out] | handle | Pointer to a DNN plugin object |
| [in] | layerName | Name of the custom layer |
| [in] | data | Serialized layer data |
| [in] | length | Length of the serialized data |
| dwStatus _dwDNNPlugin_initializeFromWeights | ( | _dwDNNPluginHandle_t * | handle, |
| const char8_t * | layerName, | ||
| const dwDNNPluginWeights * | weights, | ||
| int32_t | numWeights | ||
| ) |
Initializes the custom plugin from weights.
| [out] | handle | Pointer to a DNN Plugin object |
| [in] | layerName | Name of the custom layer |
| [in] | weights | Array of weights structure |
| [in] | numWeights | Number of weights structure in weights |
| dwStatus _dwDNNPlugin_isOutputBroadcastAcrossBatch | ( | bool * | isOutputBroadcastAcrossBatch, |
| int32_t | outputIndex, | ||
| const bool * | inputIsBroadcasted, | ||
| int32_t | numInputs, | ||
| _dwConstDNNPluginHandle_t | handle | ||
| ) |
Returns whether output is broadcast across batch.
| [out] | isOutputBroadcastAcrossBatch | Flag indicating whether output at outputIndex is broadcast across batch |
| [in] | outputIndex | Output index |
| [in] | inputIsBroadcasted | List of flags indicating whether inputs are broadcasted |
| [in] | numInputs | Number of inputs |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_release | ( | _dwDNNPluginHandle_t | handle | ) |
Releases the custom plugin.
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_serialize | ( | void * | buffer, |
| _dwDNNPluginHandle_t | handle | ||
| ) |
Serializes the plugin to buffer.
The size of the buffer is returned by _dwDNNPlugin_getSerializationSize.
| [out] | buffer | Buffer to store the layer to |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_setPluginNamespace | ( | const char8_t * | pluginNamespace, |
| _dwDNNPluginHandle_t | handle | ||
| ) |
Sets plugin namespace.
| [in] | pluginNamespace | Plugin namespace |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_setup | ( | _dwDNNPluginHandle_t | handle | ) |
Initializes the created plugin.
| [in] | handle | Pointer to a DNN plugin object. |
| dwStatus _dwDNNPlugin_supportsFormat | ( | bool * | res, |
| dwPrecision | precision, | ||
| dwDNNPluginLayout | pluginLayout, | ||
| _dwDNNPluginHandle_t | handle | ||
| ) |
Returns a flag indicating whether the given format is supported.
| [out] | res | Flag indicating whether the given format is supported |
| [in] | precision | Precision |
| [in] | pluginLayout | Layout |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_supportsFormatCombination | ( | bool * | res, |
| int32_t | index, | ||
| const dwDNNPluginTensorDesc * | inOut, | ||
| int32_t | numInputs, | ||
| int32_t | numOutputs, | ||
| _dwConstDNNPluginHandle_t | handle | ||
| ) |
Returns a flag indicating whether the given format is supported.
| [out] | res | Flag indicating whether the given format is supported |
| [in] | index | Index of the tensor descriptor in inOut. |
| [in] | inOut | List of input/output tensor descriptors. |
| [in] | numInputs | Number of inputs. |
| [in] | numOutputs | Number of outputs |
| [in] | handle | Pointer to a DNN plugin object |
| dwStatus _dwDNNPlugin_terminate | ( | _dwDNNPluginHandle_t | handle | ) |
Terminates the plugin.
| [in] | handle | Pointer to a DNN plugin object. |