TensorRT 8.5.10
NvInferRuntimeCommon.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 1993-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
13#ifndef NV_INFER_RUNTIME_COMMON_H
14#define NV_INFER_RUNTIME_COMMON_H
15
16#include "NvInferVersion.h"
17#include <cstddef>
18#include <cstdint>
19#include <cuda_runtime_api.h>
20
21// Items that are marked as deprecated will be removed in a future release.
22#if __cplusplus >= 201402L
23#define TRT_DEPRECATED [[deprecated]]
24#if __GNUC__ < 6
25#define TRT_DEPRECATED_ENUM
26#else
27#define TRT_DEPRECATED_ENUM TRT_DEPRECATED
28#endif
29#ifdef _MSC_VER
30#define TRT_DEPRECATED_API __declspec(dllexport)
31#else
32#define TRT_DEPRECATED_API [[deprecated]] __attribute__((visibility("default")))
33#endif
34#else
35#ifdef _MSC_VER
36#define TRT_DEPRECATED
37#define TRT_DEPRECATED_ENUM
38#define TRT_DEPRECATED_API __declspec(dllexport)
39#else
40#define TRT_DEPRECATED __attribute__((deprecated))
41#define TRT_DEPRECATED_ENUM
42#define TRT_DEPRECATED_API __attribute__((deprecated, visibility("default")))
43#endif
44#endif
45
46// Defines which symbols are exported
47#ifdef TENSORRT_BUILD_LIB
48#ifdef _MSC_VER
49#define TENSORRTAPI __declspec(dllexport)
50#else
51#define TENSORRTAPI __attribute__((visibility("default")))
52#endif
53#else
54#define TENSORRTAPI
55#endif
56#define TRTNOEXCEPT
62
63// forward declare some CUDA types to avoid an include dependency
64
65extern "C"
66{
68 struct cublasContext;
70 struct cudnnContext;
71}
72
73#define NV_TENSORRT_VERSION nvinfer1::kNV_TENSORRT_VERSION_IMPL
79namespace nvinfer1
80{
81
82static constexpr int32_t kNV_TENSORRT_VERSION_IMPL
83 = (NV_TENSORRT_MAJOR * 1000) + (NV_TENSORRT_MINOR * 100) + NV_TENSORRT_PATCH; // major, minor, patch
84
86using char_t = char;
87
92
94class IErrorRecorder;
96class IGpuAllocator;
97
98namespace impl
99{
101template <typename T>
103} // namespace impl
104
106template <typename T>
107constexpr int32_t EnumMax() noexcept
108{
110}
111
116enum class DataType : int32_t
117{
119 kFLOAT = 0,
120
122 kHALF = 1,
123
125 kINT8 = 2,
126
128 kINT32 = 3,
129
131 kBOOL = 4,
132
145 kUINT8 = 5
146
147};
148
149namespace impl
150{
152template <>
154{
155 // Declaration of kVALUE that represents maximum number of elements in DataType enum
156 static constexpr int32_t kVALUE = 6;
157};
158} // namespace impl
159
171{
172public:
174 static constexpr int32_t MAX_DIMS{8};
176 int32_t nbDims;
178 int32_t d[MAX_DIMS];
179};
180
186using Dims = Dims32;
187
200enum class TensorFormat : int32_t
201{
209 kLINEAR = 0,
210
217 kCHW2 = 1,
218
225 kHWC8 = 2,
226
242 kCHW4 = 3,
243
254 kCHW16 = 4,
255
265 kCHW32 = 5,
266
273 kDHWC8 = 6,
274
281 kCDHW32 = 7,
282
285 kHWC = 8,
286
295 kDLA_LINEAR = 9,
296
310 kDLA_HWC4 = 10,
311
318 kHWC16 = 11
319};
320
327
328namespace impl
329{
331template <>
333{
335 static constexpr int32_t kVALUE = 12;
336};
337} // namespace impl
338
350{
358 float scale;
359};
360
367enum class PluginVersion : uint8_t
368{
370 kV2 = 0,
372 kV2_EXT = 1,
374 kV2_IOEXT = 2,
376 kV2_DYNAMICEXT = 3,
377};
378
394{
395public:
406 virtual int32_t getTensorRTVersion() const noexcept
407 {
408 return NV_TENSORRT_VERSION;
409 }
410
423 virtual AsciiChar const* getPluginType() const noexcept = 0;
424
437 virtual AsciiChar const* getPluginVersion() const noexcept = 0;
438
452 virtual int32_t getNbOutputs() const noexcept = 0;
453
473 virtual Dims getOutputDimensions(int32_t index, Dims const* inputs, int32_t nbInputDims) noexcept = 0;
474
497 virtual bool supportsFormat(DataType type, PluginFormat format) const noexcept = 0;
498
530 virtual void configureWithFormat(Dims const* inputDims, int32_t nbInputs, Dims const* outputDims, int32_t nbOutputs,
531 DataType type, PluginFormat format, int32_t maxBatchSize) noexcept
532 = 0;
533
545 virtual int32_t initialize() noexcept = 0;
546
559 virtual void terminate() noexcept = 0;
560
575 virtual size_t getWorkspaceSize(int32_t maxBatchSize) const noexcept = 0;
576
593 virtual int32_t enqueue(int32_t batchSize, void const* const* inputs, void* const* outputs, void* workspace,
594 cudaStream_t stream) noexcept
595 = 0;
596
607 virtual size_t getSerializationSize() const noexcept = 0;
608
622 virtual void serialize(void* buffer) const noexcept = 0;
623
632 virtual void destroy() noexcept = 0;
633
648 virtual IPluginV2* clone() const noexcept = 0;
649
664 virtual void setPluginNamespace(AsciiChar const* pluginNamespace) noexcept = 0;
665
674 virtual AsciiChar const* getPluginNamespace() const noexcept = 0;
675
676 // @cond SuppressDoxyWarnings
677 IPluginV2() = default;
678 virtual ~IPluginV2() noexcept = default;
679// @endcond
680
681protected:
682// @cond SuppressDoxyWarnings
683 IPluginV2(IPluginV2 const&) = default;
684 IPluginV2(IPluginV2&&) = default;
685 IPluginV2& operator=(IPluginV2 const&) & = default;
686 IPluginV2& operator=(IPluginV2&&) & = default;
687// @endcond
688};
689
704{
705public:
722 int32_t index, nvinfer1::DataType const* inputTypes, int32_t nbInputs) const noexcept
723 = 0;
724
741 int32_t outputIndex, bool const* inputIsBroadcasted, int32_t nbInputs) const noexcept
742 = 0;
743
762 virtual bool canBroadcastInputAcrossBatch(int32_t inputIndex) const noexcept = 0;
763
798 virtual void configurePlugin(Dims const* inputDims, int32_t nbInputs, Dims const* outputDims, int32_t nbOutputs,
799 DataType const* inputTypes, DataType const* outputTypes, bool const* inputIsBroadcast,
800 bool const* outputIsBroadcast, PluginFormat floatFormat, int32_t maxBatchSize) noexcept
801 = 0;
802
803 IPluginV2Ext() = default;
804 ~IPluginV2Ext() override = default;
805
829 virtual void attachToContext(
830 cudnnContext* /*cudnn*/, cublasContext* /*cublas*/, IGpuAllocator* /*allocator*/) noexcept
831 {
832 }
833
847 virtual void detachFromContext() noexcept {}
848
861 IPluginV2Ext* clone() const noexcept override = 0;
862
863protected:
864 // @cond SuppressDoxyWarnings
865 IPluginV2Ext(IPluginV2Ext const&) = default;
866 IPluginV2Ext(IPluginV2Ext&&) = default;
867 IPluginV2Ext& operator=(IPluginV2Ext const&) & = default;
868 IPluginV2Ext& operator=(IPluginV2Ext&&) & = default;
869// @endcond
870
882 int32_t getTensorRTVersion() const noexcept override
883 {
884 return static_cast<int32_t>((static_cast<uint32_t>(PluginVersion::kV2_EXT) << 24U)
885 | (static_cast<uint32_t>(NV_TENSORRT_VERSION) & 0xFFFFFFU));
886 }
887
891 void configureWithFormat(Dims const* /*inputDims*/, int32_t /*nbInputs*/, Dims const* /*outputDims*/,
892 int32_t /*nbOutputs*/, DataType /*type*/, PluginFormat /*format*/, int32_t /*maxBatchSize*/) noexcept override
893 {
894 }
895};
896
907{
908public:
926 virtual void configurePlugin(
927 PluginTensorDesc const* in, int32_t nbInput, PluginTensorDesc const* out, int32_t nbOutput) noexcept
928 = 0;
929
968 int32_t pos, PluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs) const noexcept
969 = 0;
970
971 // @cond SuppressDoxyWarnings
972 IPluginV2IOExt() = default;
973 ~IPluginV2IOExt() override = default;
974// @endcond
975
976protected:
977// @cond SuppressDoxyWarnings
978 IPluginV2IOExt(IPluginV2IOExt const&) = default;
979 IPluginV2IOExt(IPluginV2IOExt&&) = default;
980 IPluginV2IOExt& operator=(IPluginV2IOExt const&) & = default;
981 IPluginV2IOExt& operator=(IPluginV2IOExt&&) & = default;
982// @endcond
983
995 int32_t getTensorRTVersion() const noexcept override
996 {
997 return static_cast<int32_t>((static_cast<uint32_t>(PluginVersion::kV2_IOEXT) << 24U)
998 | (static_cast<uint32_t>(NV_TENSORRT_VERSION) & 0xFFFFFFU));
999 }
1000
1001private:
1002 // Following are obsolete base class methods, and must not be implemented or used.
1003
1004 void configurePlugin(Dims const*, int32_t, Dims const*, int32_t, DataType const*, DataType const*, bool const*,
1005 bool const*, PluginFormat, int32_t) noexcept final
1006 {
1007 }
1008
1009 bool supportsFormat(DataType, PluginFormat) const noexcept final
1010 {
1011 return false;
1012 }
1013};
1014
1019
1020enum class PluginFieldType : int32_t
1021{
1023 kFLOAT16 = 0,
1025 kFLOAT32 = 1,
1027 kFLOAT64 = 2,
1029 kINT8 = 3,
1031 kINT16 = 4,
1033 kINT32 = 5,
1035 kCHAR = 6,
1037 kDIMS = 7,
1039 kUNKNOWN = 8
1040};
1041
1050{
1051public:
1059 void const* data;
1068 int32_t length;
1069
1070 PluginField(AsciiChar const* const name_ = nullptr, void const* const data_ = nullptr,
1071 PluginFieldType const type_ = PluginFieldType::kUNKNOWN, int32_t const length_ = 0) noexcept
1072 : name(name_)
1073 , data(data_)
1074 , type(type_)
1075 , length(length_)
1076 {
1077 }
1078};
1079
1082{
1084 int32_t nbFields;
1087};
1088
1096
1098{
1099public:
1107 virtual int32_t getTensorRTVersion() const noexcept
1108 {
1109 return NV_TENSORRT_VERSION;
1110 }
1111
1124 virtual AsciiChar const* getPluginName() const noexcept = 0;
1125
1138 virtual AsciiChar const* getPluginVersion() const noexcept = 0;
1139
1150 virtual PluginFieldCollection const* getFieldNames() noexcept = 0;
1151
1161 virtual IPluginV2* createPlugin(AsciiChar const* name, PluginFieldCollection const* fc) noexcept = 0;
1162
1172 virtual IPluginV2* deserializePlugin(AsciiChar const* name, void const* serialData, size_t serialLength) noexcept
1173 = 0;
1174
1187 virtual void setPluginNamespace(AsciiChar const* pluginNamespace) noexcept = 0;
1188
1201 virtual AsciiChar const* getPluginNamespace() const noexcept = 0;
1202
1203 IPluginCreator() = default;
1204 virtual ~IPluginCreator() = default;
1205
1206protected:
1207// @cond SuppressDoxyWarnings
1208 IPluginCreator(IPluginCreator const&) = default;
1209 IPluginCreator(IPluginCreator&&) = default;
1210 IPluginCreator& operator=(IPluginCreator const&) & = default;
1211 IPluginCreator& operator=(IPluginCreator&&) & = default;
1212// @endcond
1213};
1214
1232
1234{
1235public:
1247 virtual bool registerCreator(IPluginCreator& creator, AsciiChar const* const pluginNamespace) noexcept = 0;
1248
1257 virtual IPluginCreator* const* getPluginCreatorList(int32_t* const numCreators) const noexcept = 0;
1258
1270 virtual IPluginCreator* getPluginCreator(AsciiChar const* const pluginName, AsciiChar const* const pluginVersion,
1271 AsciiChar const* const pluginNamespace = "") noexcept
1272 = 0;
1273
1274 // @cond SuppressDoxyWarnings
1275 IPluginRegistry() = default;
1276 IPluginRegistry(IPluginRegistry const&) = delete;
1277 IPluginRegistry(IPluginRegistry&&) = delete;
1278 IPluginRegistry& operator=(IPluginRegistry const&) & = delete;
1279 IPluginRegistry& operator=(IPluginRegistry&&) & = delete;
1280// @endcond
1281
1282protected:
1283 virtual ~IPluginRegistry() noexcept = default;
1284
1285public:
1295 //
1302 virtual void setErrorRecorder(IErrorRecorder* const recorder) noexcept = 0;
1303
1319 virtual IErrorRecorder* getErrorRecorder() const noexcept = 0;
1320
1336 virtual bool deregisterCreator(IPluginCreator const& creator) noexcept = 0;
1337};
1338
1339enum class AllocatorFlag : int32_t
1340{
1341 kRESIZABLE = 0,
1342};
1343
1344namespace impl
1345{
1347template <>
1349{
1350 static constexpr int32_t kVALUE = 1;
1351};
1352} // namespace impl
1353
1354using AllocatorFlags = uint32_t;
1355
1362{
1363public:
1385 virtual void* allocate(uint64_t const size, uint64_t const alignment, AllocatorFlags const flags) noexcept = 0;
1386
1405 TRT_DEPRECATED virtual void free(void* const memory) noexcept = 0;
1406
1411 virtual ~IGpuAllocator() = default;
1412 IGpuAllocator() = default;
1413
1447 virtual void* reallocate(void* /*baseAddr*/, uint64_t /*alignment*/, uint64_t /*newSize*/) noexcept
1448 {
1449 return nullptr;
1450 }
1451
1472 virtual bool deallocate(void* const memory) noexcept
1473 {
1474 this->free(memory);
1475 return true;
1476 }
1477
1478protected:
1479// @cond SuppressDoxyWarnings
1480 IGpuAllocator(IGpuAllocator const&) = default;
1481 IGpuAllocator(IGpuAllocator&&) = default;
1482 IGpuAllocator& operator=(IGpuAllocator const&) & = default;
1483 IGpuAllocator& operator=(IGpuAllocator&&) & = default;
1484// @endcond
1485};
1486
1500{
1501public:
1507 enum class Severity : int32_t
1508 {
1510 kINTERNAL_ERROR = 0,
1512 kERROR = 1,
1514 kWARNING = 2,
1516 kINFO = 3,
1518 kVERBOSE = 4,
1519 };
1520
1533 virtual void log(Severity severity, AsciiChar const* msg) noexcept = 0;
1534
1535 ILogger() = default;
1536 virtual ~ILogger() = default;
1537
1538protected:
1539// @cond SuppressDoxyWarnings
1540 ILogger(ILogger const&) = default;
1541 ILogger(ILogger&&) = default;
1542 ILogger& operator=(ILogger const&) & = default;
1543 ILogger& operator=(ILogger&&) & = default;
1544// @endcond
1545};
1546
1547namespace impl
1548{
1550template <>
1551struct EnumMaxImpl<ILogger::Severity>
1552{
1554 static constexpr int32_t kVALUE = 5;
1555};
1556} // namespace impl
1557
1563enum class ErrorCode : int32_t
1564{
1568 kSUCCESS = 0,
1569
1574
1579 kINTERNAL_ERROR = 2,
1580
1586
1594 kINVALID_CONFIG = 4,
1595
1602
1608
1616
1625
1638 kINVALID_STATE = 9,
1639
1650 kUNSUPPORTED_STATE = 10,
1651
1652};
1653
1654namespace impl
1655{
1657template <>
1659{
1661 static constexpr int32_t kVALUE = 11;
1662};
1663} // namespace impl
1664
1689{
1690public:
1694 using ErrorDesc = char const*;
1695
1699 static constexpr size_t kMAX_DESC_LENGTH{127U};
1700
1704 using RefCount = int32_t;
1705
1706 IErrorRecorder() = default;
1707 virtual ~IErrorRecorder() noexcept = default;
1708
1709 // Public API used to retrieve information from the error recorder.
1710
1729 virtual int32_t getNbErrors() const noexcept = 0;
1730
1748 virtual ErrorCode getErrorCode(int32_t errorIdx) const noexcept = 0;
1749
1769 virtual ErrorDesc getErrorDesc(int32_t errorIdx) const noexcept = 0;
1770
1785 virtual bool hasOverflowed() const noexcept = 0;
1786
1801 virtual void clear() noexcept = 0;
1802
1803 // API used by TensorRT to report Error information to the application.
1804
1825 virtual bool reportError(ErrorCode val, ErrorDesc desc) noexcept = 0;
1826
1843 virtual RefCount incRefCount() noexcept = 0;
1844
1861 virtual RefCount decRefCount() noexcept = 0;
1862
1863protected:
1864 // @cond SuppressDoxyWarnings
1865 IErrorRecorder(IErrorRecorder const&) = default;
1866 IErrorRecorder(IErrorRecorder&&) = default;
1867 IErrorRecorder& operator=(IErrorRecorder const&) & = default;
1868 IErrorRecorder& operator=(IErrorRecorder&&) & = default;
1869 // @endcond
1870}; // class IErrorRecorder
1871
1877enum class TensorIOMode : int32_t
1878{
1880 kNONE = 0,
1881
1883 kINPUT = 1,
1884
1886 kOUTPUT = 2
1887};
1888
1889namespace impl
1890{
1892template <>
1894{
1895 // Declaration of kVALUE that represents maximum number of elements in TensorIOMode enum
1896 static constexpr int32_t kVALUE = 3;
1897};
1898} // namespace impl
1899} // namespace nvinfer1
1900
1906extern "C" TENSORRTAPI int32_t getInferLibVersion() noexcept;
1907
1908#endif // NV_INFER_RUNTIME_COMMON_H
#define TENSORRTAPI
Definition: NvInferRuntimeCommon.h:54
int32_t getInferLibVersion() noexcept
Return the library version number.
#define NV_TENSORRT_VERSION
Definition: NvInferRuntimeCommon.h:73
#define TRT_DEPRECATED
Definition: NvInferRuntimeCommon.h:40
#define NV_TENSORRT_MINOR
TensorRT minor version.
Definition: NvInferVersion.h:23
#define NV_TENSORRT_MAJOR
TensorRT major version.
Definition: NvInferVersion.h:22
#define NV_TENSORRT_PATCH
TensorRT patch version.
Definition: NvInferVersion.h:24
Definition: NvInferRuntimeCommon.h:171
int32_t nbDims
The rank (number of dimensions).
Definition: NvInferRuntimeCommon.h:176
static constexpr int32_t MAX_DIMS
The maximum rank (number of dimensions) supported for a tensor.
Definition: NvInferRuntimeCommon.h:174
int32_t d[MAX_DIMS]
The extent of each dimension.
Definition: NvInferRuntimeCommon.h:178
Reference counted application-implemented error reporting interface for TensorRT objects.
Definition: NvInferRuntimeCommon.h:1689
virtual ~IErrorRecorder() noexcept=default
char const * ErrorDesc
Definition: NvInferRuntimeCommon.h:1694
int32_t RefCount
Definition: NvInferRuntimeCommon.h:1704
Application-implemented class for controlling allocation on the GPU.
Definition: NvInferRuntimeCommon.h:1362
virtual bool deallocate(void *const memory) noexcept
Definition: NvInferRuntimeCommon.h:1472
virtual void * reallocate(void *, uint64_t, uint64_t) noexcept
Definition: NvInferRuntimeCommon.h:1447
virtual ~IGpuAllocator()=default
virtual void * allocate(uint64_t const size, uint64_t const alignment, AllocatorFlags const flags) noexcept=0
virtual TRT_DEPRECATED void free(void *const memory) noexcept=0
Application-implemented logging interface for the builder, refitter and runtime.
Definition: NvInferRuntimeCommon.h:1500
virtual ~ILogger()=default
Severity
Definition: NvInferRuntimeCommon.h:1508
virtual void log(Severity severity, AsciiChar const *msg) noexcept=0
Plugin creator class for user implemented layers.
Definition: NvInferRuntimeCommon.h:1098
virtual int32_t getTensorRTVersion() const noexcept
Return the version of the API the plugin creator was compiled with.
Definition: NvInferRuntimeCommon.h:1107
virtual AsciiChar const * getPluginName() const noexcept=0
Return the plugin name.
Single registration point for all plugins in an application. It is used to find plugin implementation...
Definition: NvInferRuntimeCommon.h:1234
virtual bool registerCreator(IPluginCreator &creator, AsciiChar const *const pluginNamespace) noexcept=0
Register a plugin creator. Returns false if one with same type is already registered.
virtual IPluginCreator * getPluginCreator(AsciiChar const *const pluginName, AsciiChar const *const pluginVersion, AsciiChar const *const pluginNamespace="") noexcept=0
Return plugin creator based on plugin name, version, and namespace associated with plugin during netw...
virtual IPluginCreator *const * getPluginCreatorList(int32_t *const numCreators) const noexcept=0
Return all the registered plugin creators and the number of registered plugin creators....
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:704
~IPluginV2Ext() override=default
virtual bool canBroadcastInputAcrossBatch(int32_t inputIndex) const noexcept=0
Return true if plugin can use input that is broadcast across batch without replication.
void configureWithFormat(Dims const *, int32_t, Dims const *, int32_t, DataType, PluginFormat, int32_t) noexcept override
Derived classes should not implement this. In a C++11 API it would be override final.
Definition: NvInferRuntimeCommon.h:891
virtual bool isOutputBroadcastAcrossBatch(int32_t outputIndex, bool const *inputIsBroadcasted, int32_t nbInputs) const noexcept=0
Return true if output tensor is broadcast across a batch.
IPluginV2Ext * clone() const noexcept override=0
Clone the plugin object. This copies over internal plugin parameters as well and returns a new plugin...
virtual void configurePlugin(Dims const *inputDims, int32_t nbInputs, Dims const *outputDims, int32_t nbOutputs, DataType const *inputTypes, DataType const *outputTypes, bool const *inputIsBroadcast, bool const *outputIsBroadcast, PluginFormat floatFormat, int32_t maxBatchSize) noexcept=0
Configure the layer with input and output data types.
virtual void detachFromContext() noexcept
Detach the plugin object from its execution context.
Definition: NvInferRuntimeCommon.h:847
virtual void attachToContext(cudnnContext *, cublasContext *, IGpuAllocator *) noexcept
Attach the plugin object to an execution context and grant the plugin the access to some context reso...
Definition: NvInferRuntimeCommon.h:829
virtual nvinfer1::DataType getOutputDataType(int32_t index, nvinfer1::DataType const *inputTypes, int32_t nbInputs) const noexcept=0
Return the DataType of the plugin output at the requested index.
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:394
virtual AsciiChar const * getPluginType() const noexcept=0
Return the plugin type. Should match the plugin name returned by the corresponding plugin creator.
virtual int32_t getTensorRTVersion() const noexcept
Return the API version with which this plugin was built.
Definition: NvInferRuntimeCommon.h:406
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:907
int32_t getTensorRTVersion() const noexcept override
Return the API version with which this plugin was built. The upper byte is reserved by TensorRT and i...
Definition: NvInferRuntimeCommon.h:995
virtual void configurePlugin(PluginTensorDesc const *in, int32_t nbInput, PluginTensorDesc const *out, int32_t nbOutput) noexcept=0
Configure the layer.
virtual bool supportsFormatCombination(int32_t pos, PluginTensorDesc const *inOut, int32_t nbInputs, int32_t nbOutputs) const noexcept=0
Return true if plugin supports the format and datatype for the input/output indexed by pos.
Structure containing plugin attribute field names and associated data This information can be parsed ...
Definition: NvInferRuntimeCommon.h:1050
AsciiChar const * name
Plugin field attribute name.
Definition: NvInferRuntimeCommon.h:1055
PluginField(AsciiChar const *const name_=nullptr, void const *const data_=nullptr, PluginFieldType const type_=PluginFieldType::kUNKNOWN, int32_t const length_=0) noexcept
Definition: NvInferRuntimeCommon.h:1070
void const * data
Plugin field attribute data.
Definition: NvInferRuntimeCommon.h:1059
int32_t length
Number of data entries in the Plugin attribute.
Definition: NvInferRuntimeCommon.h:1068
PluginFieldType type
Plugin field attribute type.
Definition: NvInferRuntimeCommon.h:1064
The TensorRT API version 1 namespace.
ErrorCode
Error codes that can be returned by TensorRT during execution.
Definition: NvInferRuntimeCommon.h:1564
TensorIOMode
Definition of tensor IO Mode.
Definition: NvInferRuntimeCommon.h:1878
PluginFieldType
Definition: NvInferRuntimeCommon.h:1021
@ kUNKNOWN
Unknown field type.
@ kFLOAT32
FP32 field type.
@ kCHAR
char field type.
@ kINT16
INT16 field type.
@ kDIMS
nvinfer1::Dims field type.
@ kFLOAT64
FP64 field type.
@ kFLOAT16
FP16 field type.
char_t AsciiChar
Definition: NvInferRuntimeCommon.h:91
char char_t
char_t is the type used by TensorRT to represent all valid characters.
Definition: NvInferRuntimeCommon.h:86
@ kV2_DYNAMICEXT
IPluginV2DynamicExt.
@ kV2_IOEXT
IPluginV2IOExt.
@ kV2_EXT
IPluginV2Ext.
@ kOUTPUT
Output gate (o).
@ kINPUT
Input gate (i).
DataType
The type of weights and tensors.
Definition: NvInferRuntimeCommon.h:117
@ kFLOAT
32-bit floating point format.
@ kBOOL
8-bit boolean. 0 = false, 1 = true, other values undefined.
@ kHALF
IEEE 16-bit floating-point format.
@ kINT8
Signed 8-bit integer representing a quantized floating-point value.
@ kINT32
Signed 32-bit integer format.
TensorFormat PluginFormat
PluginFormat is reserved for backward compatibility.
Definition: NvInferRuntimeCommon.h:326
@ kINT8
Enable Int8 layer selection, with FP32 fallback with FP16 fallback if kFP16 also specified.
TensorFormat
Format of the input/output tensors.
Definition: NvInferRuntimeCommon.h:201
constexpr int32_t EnumMax() noexcept
Maximum number of elements in an enumeration type.
Definition: NvInferRuntimeCommon.h:107
AllocatorFlag
Definition: NvInferRuntimeCommon.h:1340
@ kRESIZABLE
TensorRT may call realloc() on this allocation.
uint32_t AllocatorFlags
Definition: NvInferRuntimeCommon.h:1354
Definition of plugin versions.
Plugin field collection struct.
Definition: NvInferRuntimeCommon.h:1082
PluginField const * fields
Pointer to PluginField entries.
Definition: NvInferRuntimeCommon.h:1086
int32_t nbFields
Number of PluginField entries.
Definition: NvInferRuntimeCommon.h:1084
Fields that a plugin might see for an input or output.
Definition: NvInferRuntimeCommon.h:350
DataType type
Definition: NvInferRuntimeCommon.h:354
Dims dims
Dimensions.
Definition: NvInferRuntimeCommon.h:352
TensorFormat format
Tensor format.
Definition: NvInferRuntimeCommon.h:356
float scale
Scale for INT8 data type.
Definition: NvInferRuntimeCommon.h:358
Declaration of EnumMaxImpl struct to store maximum number of elements in an enumeration type.
Definition: NvInferRuntimeCommon.h:102