13#ifndef NV_INFER_RUNTIME_PLUGIN_H
14#define NV_INFER_RUNTIME_PLUGIN_H
141 virtual
AsciiChar const* getPluginVersion() const noexcept = 0;
156 virtual int32_t getNbOutputs() const noexcept = 0;
177 virtual
Dims getOutputDimensions(int32_t index,
Dims const* inputs, int32_t nbInputDims) noexcept = 0;
234 virtual
void configureWithFormat(
Dims const* inputDims, int32_t nbInputs,
Dims const* outputDims, int32_t nbOutputs,
249 virtual int32_t initialize() noexcept = 0;
263 virtual
void terminate() noexcept = 0;
279 virtual
size_t getWorkspaceSize(int32_t maxBatchSize) const noexcept = 0;
297 virtual int32_t enqueue(int32_t batchSize,
void const* const* inputs,
void* const* outputs,
void* workspace,
298 cudaStream_t stream) noexcept
311 virtual
size_t getSerializationSize() const noexcept = 0;
326 virtual
void serialize(
void* buffer) const noexcept = 0;
336 virtual
void destroy() noexcept = 0;
368 virtual
void setPluginNamespace(
AsciiChar const* pluginNamespace) noexcept = 0;
378 virtual
AsciiChar const* getPluginNamespace() const noexcept = 0;
445 int32_t outputIndex,
bool const* inputIsBroadcasted, int32_t nbInputs)
const noexcept
504 DataType const* inputTypes,
DataType const* outputTypes,
bool const* inputIsBroadcast,
505 bool const* outputIsBroadcast,
PluginFormat floatFormat, int32_t maxBatchSize)
noexcept
587 int32_t getTensorRTVersion() const noexcept
override
673 int32_t pos,
PluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs)
const noexcept
843 virtual
AsciiChar const* getPluginVersion() const noexcept = 0;
877 virtual
IPluginV2* deserializePlugin(
AsciiChar const* name,
void const* serialData,
size_t serialLength) noexcept
892 virtual
void setPluginNamespace(
AsciiChar const* pluginNamespace) noexcept = 0;
906 virtual
AsciiChar const* getPluginNamespace() const noexcept = 0;
#define NV_TENSORRT_VERSION
Definition: NvInferRuntimeBase.h:76
#define TRT_DEPRECATED
Definition: NvInferRuntimeBase.h:40
Definition: NvInferRuntimeBase.h:179
Application-implemented class for controlling allocation on the GPU.
Definition: NvInferRuntimeBase.h:367
Plugin creator class for user implemented layers.
Definition: NvInferRuntimePlugin.h:803
virtual int32_t getTensorRTVersion() const noexcept
Return the version of the API the plugin creator was compiled with.
Definition: NvInferRuntimePlugin.h:812
virtual AsciiChar const * getPluginName() const noexcept=0
Return the plugin name.
Plugin class for user-implemented layers.
Definition: NvInferRuntimePlugin.h:408
~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: NvInferRuntimePlugin.h:596
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: NvInferRuntimePlugin.h:552
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:534
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:98
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:110
Plugin class for user-implemented layers.
Definition: NvInferRuntimePlugin.h:612
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:700
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: NvInferRuntimePlugin.h:755
AsciiChar const * name
Plugin field attribute name.
Definition: NvInferRuntimePlugin.h:760
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:775
void const * data
Plugin field attribute data.
Definition: NvInferRuntimePlugin.h:764
int32_t length
Number of data entries in the Plugin attribute.
Definition: NvInferRuntimePlugin.h:773
PluginFieldType type
Plugin field attribute type.
Definition: NvInferRuntimePlugin.h:769
The TensorRT API version 1 namespace.
PluginFieldType
The possible field types for custom layer.
Definition: NvInferRuntimePlugin.h:726
@ 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.
char_t AsciiChar
Definition: NvInferRuntimeBase.h:94
@ kV2_DYNAMICEXT
IPluginV2DynamicExt.
@ kV2_IOEXT
IPluginV2IOExt.
DataType
The type of weights and tensors.
Definition: NvInferRuntimeBase.h:120
@ kINT32
Signed 32-bit integer format.
TensorFormat PluginFormat
PluginFormat is reserved for backward compatibility.
Definition: NvInferRuntimePlugin.h:41
@ 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:209
Definition of plugin versions.
Plugin field collection struct.
Definition: NvInferRuntimePlugin.h:787
PluginField const * fields
Pointer to PluginField entries.
Definition: NvInferRuntimePlugin.h:791
int32_t nbFields
Number of PluginField entries.
Definition: NvInferRuntimePlugin.h:789
Fields that a plugin might see for an input or output.
Definition: NvInferRuntimePlugin.h:54
DataType type
Definition: NvInferRuntimePlugin.h:58
Dims dims
Dimensions.
Definition: NvInferRuntimePlugin.h:56
TensorFormat format
Tensor format.
Definition: NvInferRuntimePlugin.h:60
float scale
Scale for INT8 data type.
Definition: NvInferRuntimePlugin.h:62