18#ifndef NV_INFER_RUNTIME_PLUGIN_H
19#define NV_INFER_RUNTIME_PLUGIN_H
51static constexpr int32_t kPLUGIN_VERSION_PYTHON_BIT = 0x40;
173 virtual
AsciiChar const* getPluginVersion() const noexcept = 0;
188 virtual int32_t getNbOutputs() const noexcept = 0;
213 virtual
Dims getOutputDimensions(int32_t index,
Dims const* inputs, int32_t nbInputDims) noexcept = 0;
272 virtual
void configureWithFormat(
Dims const* inputDims, int32_t nbInputs,
Dims const* outputDims, int32_t nbOutputs,
287 virtual int32_t initialize() noexcept = 0;
302 virtual
void terminate() noexcept = 0;
321 virtual
size_t getWorkspaceSize(int32_t maxBatchSize) const noexcept = 0;
344 virtual int32_t enqueue(int32_t batchSize,
void const* const* inputs,
void* const* outputs,
void* workspace,
345 cudaStream_t stream) noexcept
358 virtual
size_t getSerializationSize() const noexcept = 0;
373 virtual
void serialize(
void* buffer) const noexcept = 0;
383 virtual
void destroy() noexcept = 0;
418 virtual
void setPluginNamespace(
AsciiChar const* pluginNamespace) noexcept = 0;
431 virtual
AsciiChar const* getPluginNamespace() const noexcept = 0;
512 int32_t outputIndex,
bool const* inputIsBroadcasted, int32_t nbInputs)
const noexcept
580 DataType const* inputTypes,
DataType const* outputTypes,
bool const* inputIsBroadcast,
581 bool const* outputIsBroadcast,
PluginFormat floatFormat, int32_t maxBatchSize)
noexcept
680 int32_t getTensorRTVersion() const noexcept
override
770 int32_t pos,
PluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs)
const noexcept
970 virtual
AsciiChar const* getPluginVersion() const noexcept = 0;
1014 virtual
IPluginV2* deserializePlugin(
AsciiChar const* name,
void const* serialData,
size_t serialLength) noexcept
1031 virtual
void setPluginNamespace(
AsciiChar const* pluginNamespace) noexcept = 0;
1045 virtual
AsciiChar const* getPluginNamespace() const noexcept = 0;
#define NV_TENSORRT_VERSION
Definition: NvInferRuntimeBase.h:87
#define TRT_DEPRECATED
Definition: NvInferRuntimeBase.h:45
Definition: NvInferRuntimeBase.h:195
Plugin class for user-implemented layers.
Definition: NvInferRuntimePlugin.h:462
virtual TRT_DEPRECATED bool canBroadcastInputAcrossBatch(int32_t inputIndex) const noexcept=0
Return true if the plugin can use an input tensor that is broadcast across batch without replication.
~IPluginV2Ext() override=default
void configureWithFormat(Dims const *, int32_t, Dims const *, int32_t, DataType, PluginFormat, int32_t) noexcept override
Derived classes must not implement this. In a C++11 API it would be override final.
Definition: NvInferRuntimePlugin.h:692
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: NvInferRuntimePlugin.h:639
virtual TRT_DEPRECATED bool isOutputBroadcastAcrossBatch(int32_t outputIndex, bool const *inputIsBroadcasted, int32_t nbInputs) const noexcept=0
Return true if the output tensor is broadcast across a batch.
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: NvInferRuntimePlugin.h:621
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: NvInferRuntimePlugin.h:126
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: NvInferRuntimePlugin.h:140
Plugin class for user-implemented layers.
Definition: NvInferRuntimePlugin.h:709
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: NvInferRuntimePlugin.h:797
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.
An Interface class for version control.
Definition: NvInferRuntimeBase.h:393
Version information associated with a TRT interface.
Definition: NvInferRuntimeBase.h:358
Structure containing plugin attribute field names and associated data This information can be parsed ...
Definition: NvInferRuntimePlugin.h:864
AsciiChar const * name
Plugin field attribute name.
Definition: NvInferRuntimePlugin.h:867
PluginField(AsciiChar const *const name_=nullptr, void const *const data_=nullptr, PluginFieldType const type_=PluginFieldType::kUNKNOWN, int32_t const length_=0) noexcept
Definition: NvInferRuntimePlugin.h:875
void const * data
Plugin field attribute data.
Definition: NvInferRuntimePlugin.h:869
int32_t length
Number of data entries in the Plugin attribute.
Definition: NvInferRuntimePlugin.h:873
PluginFieldType type
Plugin field attribute type.
Definition: NvInferRuntimePlugin.h:871
Definition: NvInferRuntimeBase.h:462
Definition: NvInferRuntimePlugin.h:942
virtual AsciiChar const * getPluginName() const noexcept=0
Return the plugin name.
Definition: NvInferRuntimePlugin.h:929
~IPluginCreatorInterface() noexcept override=default
The TensorRT API version 1 namespace.
PluginFieldType
The possible field types for custom layer.
Definition: NvInferRuntimePlugin.h:829
@ kUNKNOWN
Unknown field type.
@ kFLOAT32
FP32 field type.
@ kINT16
INT16 field type.
@ kDIMS
nvinfer1::Dims field type.
@ kFLOAT64
FP64 field type.
@ kFLOAT16
FP16 field type.
PluginCreatorVersion
Enum to identify version of the plugin creator.
Definition: NvInferRuntimePlugin.h:103
@ kV1_PYTHON
IPluginCreator-based Python plugin creators.
v_1_0::IPluginCreator IPluginCreator
Definition: NvInferRuntimePlugin.h:1084
PluginCapabilityType
Enumerates the different capability types a IPluginV3 object may have.
Definition: NvInferRuntimePlugin.h:904
@ kBUILD
Build capability. IPluginV3 objects provided to TensorRT build phase must have this.
@ kRUNTIME
Runtime capability. IPluginV3 objects provided to TensorRT build and execution phases must have this.
@ kCORE
Core capability. Every IPluginV3 object must have this.
char_t AsciiChar
Definition: NvInferRuntimeBase.h:101
TensorRTPhase
Indicates a phase of operation of TensorRT.
Definition: NvInferRuntimePlugin.h:919
@ kV2_DYNAMICEXT
IPluginV2DynamicExt.
@ kV2_IOEXT
IPluginV2IOExt.
@ kV2_DYNAMICEXT_PYTHON
IPluginV2DynamicExt-based Python plugins.
DataType
The type of weights and tensors.
Definition: NvInferRuntimeBase.h:129
@ kINT64
Signed 64-bit integer type.
@ kINT32
Signed 32-bit integer format.
TensorFormat PluginFormat
PluginFormat is reserved for backward compatibility.
Definition: NvInferRuntimePlugin.h:46
v_1_0::IPluginCreatorInterface IPluginCreatorInterface
Definition: NvInferRuntimePlugin.h:1075
@ kINT8
Enable Int8 layer selection, with FP32 fallback with FP16 fallback if kFP16 also specified.
TensorFormat
Format of the input/output tensors.
Definition: NvInferRuntimeBase.h:243
Definition of plugin versions.
Plugin field collection struct.
Definition: NvInferRuntimePlugin.h:891
PluginField const * fields
Pointer to PluginField entries.
Definition: NvInferRuntimePlugin.h:895
int32_t nbFields
Number of PluginField entries.
Definition: NvInferRuntimePlugin.h:893
Fields that a plugin might see for an input or output.
Definition: NvInferRuntimePlugin.h:65
DataType type
Definition: NvInferRuntimePlugin.h:69
Dims dims
Dimensions.
Definition: NvInferRuntimePlugin.h:67
TensorFormat format
Tensor format.
Definition: NvInferRuntimePlugin.h:71
float scale
Scale for INT8 data type.
Definition: NvInferRuntimePlugin.h:73