• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>

  • DriveWorks SDK Reference
    5.14.77 Release
    For Test and Development only

    All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
    DNNPlugin.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) 2018-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
    38#ifndef DW_DNN_PLUGIN_H_
    39#define DW_DNN_PLUGIN_H_
    40
    49#include <dw/core/base/Types.h>
    50
    51#ifdef __cplusplus
    52extern "C" {
    53#endif
    54
    57typedef struct
    58{
    59 const char8_t* pluginLibraryPath;
    60 const char8_t* layerName;
    62
    65typedef struct
    66{
    70
    74typedef enum dwDNNPluginLayout {
    90
    94typedef struct dwDNNPluginWeights
    95{
    97 const void* values;
    98 int64_t count;
    100
    115
    119typedef struct dwDNNPluginField
    120{
    122 const char8_t* name;
    124 const void* data;
    128 int32_t length;
    130
    135{
    136 int32_t numFields;
    139
    144{
    150
    156typedef void const* _dwConstDNNPluginHandle_t;
    157
    165
    174
    182
    190
    198
    206
    217 int32_t outputIndex, const dwBlobSize* inputDimensions,
    218 int32_t numInputs, _dwDNNPluginHandle_t handle);
    219
    227dwStatus _dwDNNPlugin_getWorkspaceSize(size_t* workspaceSize, int32_t maxBatchSize,
    228 _dwDNNPluginHandle_t handle);
    229
    242 int32_t numInputs, int32_t numOutputs,
    244
    255 const dwDNNPluginTensorDesc* outputDescs, int32_t numOutputs,
    256 _dwDNNPluginHandle_t handle);
    257
    268dwStatus _dwDNNPlugin_enqueue(int32_t batchSize, const void* const* inputs, void** outputs,
    269 void* workspace, cudaStream_t stream, _dwDNNPluginHandle_t handle);
    270
    278
    287
    297dwStatus _dwDNNPlugin_deserializeFromBuffer(const char8_t* name, const void* buffer,
    298 size_t len, _dwDNNPluginHandle_t handle);
    299
    309 const dwDNNPluginFieldCollection* fieldCollection,
    310 _dwDNNPluginHandle_t handle);
    311
    321 _dwDNNPluginHandle_t handle);
    322
    331
    340
    348dwStatus _dwDNNPlugin_setPluginNamespace(const char8_t* pluginNamespace, _dwDNNPluginHandle_t handle);
    349
    358
    370dwStatus _dwDNNPlugin_isOutputBroadcastAcrossBatch(bool* isOutputBroadcastAcrossBatch,
    371 int32_t outputIndex, const bool* inputIsBroadcasted,
    372 int32_t numInputs, _dwConstDNNPluginHandle_t handle);
    373
    383dwStatus _dwDNNPlugin_canBroadcastInputAcrossBatch(bool* canBroadcastInputAcrossBatch, int32_t inputIndex,
    385
    396dwStatus _dwDNNPlugin_getOutputPrecision(dwPrecision* outputPrecision, int32_t outputIndex,
    397 const dwPrecision* inputPrecisions, int32_t numInputs,
    399
    408 _dwDNNPluginHandle_t handle);
    409
    410// -----------------------------------------------------------------------------
    411// Deprecated Functions
    412// -----------------------------------------------------------------------------
    413
    422DW_DEPRECATED("WARNING: will be removed in the next major release")
    424 const dwDNNPluginWeights* weights, int32_t numWeights);
    425
    434DW_DEPRECATED("WARNING: will be removed in the next major release")
    435dwStatus _dwDNNPlugin_initialize(_dwDNNPluginHandle_t* handle, const char8_t* layerName,
    436 const void* data, size_t length);
    437
    443DW_DEPRECATED("WARNING: will be removed in the next major release")
    445
    458DW_DEPRECATED("WARNING: will be removed in the next major release")
    460 int32_t numInputs, const dwBlobSize* outputDimensions,
    461 int32_t numOutputs, dwPrecision precision,
    462 dwDNNPluginLayout layout, int32_t maxBatchSize,
    463 _dwDNNPluginHandle_t handle);
    464
    473DW_DEPRECATED("WARNING: will be removed in the next major release")
    475 dwDNNPluginLayout pluginLayout, _dwDNNPluginHandle_t handle);
    476
    479#ifdef __cplusplus
    480}
    481#endif
    482
    483#endif // DW_DNN_PLUGIN_H_
    dwStatus
    Status definition.
    Definition: ErrorDefs.h:45
    NVIDIA DriveWorks API: Core Types
    float float32_t
    Specifies POD types.
    Definition: BasicTypes.h:59
    #define DW_DEPRECATED(msg)
    Definition: Exports.h:66
    dwPrecision
    Precision type definitions.
    Definition: TypesExtra.h:103
    Holds blob dimensions.
    Definition: TypesExtra.h:207
    float32_t scale
    Tensor scale.
    Definition: DNNPlugin.h:148
    int64_t count
    the number of weights in the array
    Definition: DNNPlugin.h:98
    int32_t numFields
    Number of dwDNNPluginField entries.
    Definition: DNNPlugin.h:136
    const char8_t * pluginLibraryPath
    Path to a plugin shared object.
    Definition: DNNPlugin.h:59
    const void * data
    Plugin field attribute data.
    Definition: DNNPlugin.h:124
    const void * values
    the weight values, in a contiguous array
    Definition: DNNPlugin.h:97
    dwDNNPluginLayout layout
    Tensor layout.
    Definition: DNNPlugin.h:147
    dwPrecision precision
    Tensor precision.
    Definition: DNNPlugin.h:146
    const dwDNNPluginField * fields
    Pointer to dwDNNPluginField entries.
    Definition: DNNPlugin.h:137
    dwBlobSize dims
    Tensor dimensions.
    Definition: DNNPlugin.h:145
    dwPrecision precision
    data type of the weights
    Definition: DNNPlugin.h:96
    size_t numCustomLayers
    Number of custom layers.
    Definition: DNNPlugin.h:68
    int32_t length
    Number of data entries in the plugin attribute.
    Definition: DNNPlugin.h:128
    dwDNNPluginFieldType type
    Plugin fild attribute type.
    Definition: DNNPlugin.h:126
    const dwDNNCustomLayer * customLayers
    Array of custom layers.
    Definition: DNNPlugin.h:67
    const char8_t * name
    Plugin field attribute name.
    Definition: DNNPlugin.h:122
    const char8_t * layerName
    Name of the custom layer.
    Definition: DNNPlugin.h:60
    void const * _dwConstDNNPluginHandle_t
    Definition: DNNPlugin.h:156
    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.
    dwDNNPluginFieldType
    Plugin field type.
    Definition: DNNPlugin.h:104
    dwStatus _dwDNNPlugin_create(_dwDNNPluginHandle_t *handle)
    Creates a custom plugin.
    dwStatus _dwDNNPlugin_clone(_dwDNNPluginHandle_t *out, _dwDNNPluginHandle_t handle)
    Clones the plugin.
    dwStatus _dwDNNPlugin_serialize(void *buffer, _dwDNNPluginHandle_t handle)
    Serializes the plugin to buffer.
    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.
    dwStatus _dwDNNPlugin_getPluginNamespace(const char8_t **pluginNamespace, _dwConstDNNPluginHandle_t handle)
    Returns plugin namespace.
    dwStatus _dwDNNPlugin_getWorkspaceSize(size_t *workspaceSize, int32_t maxBatchSize, _dwDNNPluginHandle_t handle)
    Returns workspace size.
    void * _dwDNNPluginHandle_t
    _dwDNNPluginHandle_t can be optionally used for storing and accessing variables among the functions d...
    Definition: DNNPlugin.h:155
    dwStatus _dwDNNPlugin_initialize(_dwDNNPluginHandle_t *handle, const char8_t *layerName, const void *data, size_t length)
    Initializes the custom plugin from serialized bytes.
    dwStatus _dwDNNPlugin_deserializeFromFieldCollection(const char8_t *name, const dwDNNPluginFieldCollection *fieldCollection, _dwDNNPluginHandle_t handle)
    Deserializes plugin from field collection.
    dwStatus _dwDNNPlugin_getPluginVersion(const char8_t **pluginVersion, _dwConstDNNPluginHandle_t handle)
    Returns plugin version as string.
    dwStatus _dwDNNPlugin_getPluginType(const char8_t **pluginType, _dwConstDNNPluginHandle_t handle)
    Returns the plugin type as string.
    dwStatus _dwDNNPlugin_canBroadcastInputAcrossBatch(bool *canBroadcastInputAcrossBatch, int32_t inputIndex, _dwConstDNNPluginHandle_t handle)
    Returns whether plugin can use input that is broadcast across batch without replication.
    dwStatus _dwDNNPlugin_deserializeFromWeights(const dwDNNPluginWeights *weights, int32_t numWeights, _dwDNNPluginHandle_t handle)
    Deserializes plugin from weights.
    dwStatus _dwDNNPlugin_setup(_dwDNNPluginHandle_t handle)
    Initializes the created plugin.
    dwStatus _dwDNNPlugin_configurePlugin(const dwDNNPluginTensorDesc *inputDescs, int32_t numInputs, const dwDNNPluginTensorDesc *outputDescs, int32_t numOutputs, _dwDNNPluginHandle_t handle)
    Configures the plugin with given format.
    dwStatus _dwDNNPlugin_destroy(_dwDNNPluginHandle_t handle)
    Destroys the plugin.
    dwStatus _dwDNNPlugin_isOutputBroadcastAcrossBatch(bool *isOutputBroadcastAcrossBatch, int32_t outputIndex, const bool *inputIsBroadcasted, int32_t numInputs, _dwConstDNNPluginHandle_t handle)
    Returns whether output is broadcast across batch.
    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_initializeFromWeights(_dwDNNPluginHandle_t *handle, const char8_t *layerName, const dwDNNPluginWeights *weights, int32_t numWeights)
    Initializes the custom plugin from weights.
    dwStatus _dwDNNPlugin_getSerializationSize(size_t *serializationSize, _dwDNNPluginHandle_t handle)
    Returns serialization size.
    dwStatus _dwDNNPlugin_setPluginNamespace(const char8_t *pluginNamespace, _dwDNNPluginHandle_t handle)
    Sets plugin namespace.
    dwStatus _dwDNNPlugin_release(_dwDNNPluginHandle_t handle)
    Releases the custom plugin.
    dwStatus _dwDNNPlugin_getNumOutputs(int32_t *numOutputs, _dwDNNPluginHandle_t handle)
    Returns number of outputs.
    dwDNNPluginLayout
    Represents different layouts for plugins.
    Definition: DNNPlugin.h:74
    dwStatus _dwDNNPlugin_supportsFormat(bool *res, dwPrecision precision, dwDNNPluginLayout pluginLayout, _dwDNNPluginHandle_t handle)
    Returns a flag indicating whether the given format is supported.
    dwStatus _dwDNNPlugin_getPluginFieldCollection(dwDNNPluginFieldCollection *fieldCollection, _dwDNNPluginHandle_t handle)
    Returns a list of fields that needs to be passed to plugin at creation.
    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.
    dwStatus _dwDNNPlugin_deserializeFromBuffer(const char8_t *name, const void *buffer, size_t len, _dwDNNPluginHandle_t handle)
    Deserializes plugin from buffer.
    dwStatus _dwDNNPlugin_terminate(_dwDNNPluginHandle_t handle)
    Terminates the plugin.
    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.
    @ DW_DNN_PLUGIN_FIELD_TYPE_FLOAT16
    FP16 field type.
    Definition: DNNPlugin.h:105
    @ DW_DNN_PLUGIN_FIELD_TYPE_FLOAT64
    FP64 field type.
    Definition: DNNPlugin.h:107
    @ DW_DNN_PLUGIN_FIELD_TYPE_CHAR
    char field type.
    Definition: DNNPlugin.h:111
    @ DW_DNN_PLUGIN_FIELD_TYPE_INT8
    INT8 field type.
    Definition: DNNPlugin.h:108
    @ DW_DNN_PLUGIN_FIELD_TYPE_FLOAT32
    FP32 field type.
    Definition: DNNPlugin.h:106
    @ DW_DNN_PLUGIN_FIELD_TYPE_UNKNOWN
    Unknown field type.
    Definition: DNNPlugin.h:113
    @ DW_DNN_PLUGIN_FIELD_TYPE_DIMS
    dwBlobSize field type.
    Definition: DNNPlugin.h:112
    @ DW_DNN_PLUGIN_FIELD_TYPE_INT16
    INT16 field type.
    Definition: DNNPlugin.h:109
    @ DW_DNN_PLUGIN_FIELD_TYPE_INT32
    INT32 field type.
    Definition: DNNPlugin.h:110
    @ DW_DNN_PLUGIN_LAYOUT_DLA_LINEAR
    CHW DLA planar format.
    Definition: DNNPlugin.h:87
    @ DW_DNN_PLUGIN_LAYOUT_NHWC8
    HWC with 8-element packed channels. (C must be a multiple of 8)
    Definition: DNNPlugin.h:79
    @ DW_DNN_PLUGIN_LAYOUT_NCHW
    CHW.
    Definition: DNNPlugin.h:76
    @ DW_DNN_PLUGIN_LAYOUT_CHW4
    CHW with 4-element packed channels.
    Definition: DNNPlugin.h:81
    @ DW_DNN_PLUGIN_LAYOUT_NC2HW2
    CHW with 2-element packed channels.
    Definition: DNNPlugin.h:77
    @ DW_DNN_PLUGIN_LAYOUT_CHW2
    CHW with 2-element packed channels.
    Definition: DNNPlugin.h:78
    @ DW_DNN_PLUGIN_LAYOUT_DLA_HWC4
    HWC DLA image format.
    Definition: DNNPlugin.h:88
    @ DW_DNN_PLUGIN_LAYOUT_CHW32
    CHW with 32-element packed channels.
    Definition: DNNPlugin.h:83
    @ DW_DNN_PLUGIN_LAYOUT_CDHW32
    CDHW with 32-element packed channels.
    Definition: DNNPlugin.h:85
    @ DW_DNN_PLUGIN_LAYOUT_LINEAR
    CHW.
    Definition: DNNPlugin.h:75
    @ DW_DNN_PLUGIN_LAYOUT_HWC8
    HWC with 8-element packed channels. (C must be a multiple of 8)
    Definition: DNNPlugin.h:80
    @ DW_DNN_PLUGIN_LAYOUT_DHWC8
    DHWC with 8-element packed channels. (C must be a multiple of 8)
    Definition: DNNPlugin.h:84
    @ DW_DNN_PLUGIN_LAYOUT_CHW16
    CHW with 16-element packed channels.
    Definition: DNNPlugin.h:82
    @ DW_DNN_PLUGIN_LAYOUT_HWC
    HWC Non-vectorized channel-last format.
    Definition: DNNPlugin.h:86
    Specifies plugin configuration.
    Definition: DNNPlugin.h:58
    Specified plugin configuration.
    Definition: DNNPlugin.h:66
    DNN plugin field.
    Definition: DNNPlugin.h:120
    DNN plugin field colleciton.
    Definition: DNNPlugin.h:135
    DNN Plugin tensor descriptor.
    Definition: DNNPlugin.h:144
    Stores DNN weights.
    Definition: DNNPlugin.h:95
    人人超碰97caoporen国产