18#ifndef NV_INFER_IMPL_H
19#define NV_INFER_IMPL_H
56class IActivationLayer;
61class IConcatenationLayer;
64class IConvolutionLayer;
66class ICumulativeLayer;
67class IDeconvolutionLayer;
68class IDequantizeLayer;
70class IDynamicQuantizeLayer;
72class IElementWiseLayer;
73class IEngineInspector;
74class IExecutionContext;
77class IGridSampleLayer;
82class IIfConditionalInputLayer;
83class IIfConditionalOutputLayer;
85class IKVCacheUpdateLayer;
88class ILoopOutputLayer;
90class IMatrixMultiplyLayer;
92class IDistCollectiveLayer;
93class INetworkDefinition;
94class INormalizationLayer;
98class IOptimizationProfile;
100class IParametricReLULayer;
105class IPluginRegistry;
107class IRotaryEmbeddingLayer;
132class IRaggedSoftMaxLayer;
133class IRecurrenceLayer;
137class IReverseSequenceLayer;
139class ISafeSerializedNetworkArtifacts;
143class ISerializationConfig;
153struct TimingCacheKey;
154struct TimingCacheValue;
156using TimingCacheKey = v_1_0::TimingCacheKey;
157using TimingCacheValue = v_1_0::TimingCacheValue;
161class ITripLimitLayer;
163class IUnsqueezeLayer;
239 virtual ~VRoot() noexcept = default;
242class VHostMemory : public VRoot
245 virtual void* data() const noexcept = 0;
246 virtual std::
size_t size() const noexcept = 0;
247 virtual
DataType type() const noexcept = 0;
254class VSafeSerializedNetworkArtifacts : public VRoot
267class VDimensionExpr : public VRoot
270 virtual bool isConstant()
const = 0;
271 virtual int64_t getConstantValue()
const = 0;
272 virtual bool isSizeTensor()
const = 0;
275class VExprBuilder :
public VRoot
278 virtual IDimensionExpr
const* constant(int64_t value) = 0;
279 virtual IDimensionExpr
const* operation(
282 virtual IDimensionExpr
const* declareSizeTensor(
283 int32_t outputIndex, IDimensionExpr
const& opt, IDimensionExpr
const& upper)
287class VRuntime :
public VRoot
290 virtual IRuntime* getPImpl() noexcept = 0;
291 virtual
nvinfer1::ICudaEngine* deserializeCudaEngine(
void const* blob, std::
size_t size) noexcept = 0;
292 virtual
void setDLACore(int32_t dlaCore) noexcept = 0;
293 virtual int32_t getDLACore() const noexcept = 0;
294 virtual int32_t getNbDLACores() const noexcept = 0;
295 virtual
void setGpuAllocator(
IGpuAllocator* allocator) noexcept = 0;
296 virtual
void setErrorRecorder(
IErrorRecorder* recorder) noexcept = 0;
299 virtual
bool setMaxThreads(int32_t maxThreads) noexcept = 0;
300 virtual int32_t getMaxThreads() const noexcept = 0;
301 virtual
void setTemporaryDirectory(
char const*) noexcept = 0;
302 virtual
char const* getTemporaryDirectory() const noexcept = 0;
306 virtual
void setPluginRegistryParent(IPluginRegistry* parent) noexcept = 0;
307 virtual IRuntime* loadRuntime(
char const* path) noexcept = 0;
308 virtual
void setEngineHostCodeAllowed(
bool allowed) noexcept = 0;
309 virtual
bool getEngineHostCodeAllowed() const noexcept = 0;
324class VRefitter : public VRoot
327 virtual IRefitter* getPImpl() noexcept = 0;
328 virtual
bool setWeights(
char const* layerName,
WeightsRole role, const Weights weights) noexcept = 0;
329 virtual
bool refitCudaEngine() noexcept = 0;
330 virtual int32_t getMissing(int32_t size,
char const** layerNames,
WeightsRole* roles) noexcept = 0;
331 virtual int32_t getAll(int32_t size,
char const** layerNames,
WeightsRole* roles) noexcept = 0;
332 virtual
void setErrorRecorder(
IErrorRecorder* recorder) noexcept = 0;
334 virtual
bool setNamedWeights(
char const* name, Weights weights) noexcept = 0;
335 virtual int32_t getMissingWeights(int32_t size,
char const** weightsNames) noexcept = 0;
336 virtual int32_t getAllWeights(int32_t size,
char const** weightsNames) noexcept = 0;
338 virtual
bool setMaxThreads(int32_t maxThreads) noexcept = 0;
339 virtual int32_t getMaxThreads() const noexcept = 0;
340 virtual
bool setNamedWeightsWithLocation(
char const* name, Weights weights,
TensorLocation location) noexcept = 0;
341 virtual Weights getNamedWeights(
char const* weightsName) const noexcept = 0;
342 virtual
TensorLocation getWeightsLocation(
char const* weightsName) const noexcept = 0;
343 virtual
bool unsetNamedWeights(
char const* weightsName) noexcept = 0;
344 virtual
void setWeightsValidation(
bool weightsValidation) noexcept = 0;
345 virtual
bool getWeightsValidation() const noexcept = 0;
346 virtual
bool refitCudaEngineAsync(cudaStream_t stream) noexcept = 0;
347 virtual Weights getWeightsPrototype(
char const* weightsName) const noexcept = 0;
349 virtual
bool releaseRefitResources() noexcept = 0;
352class VOptimizationProfile : public VRoot
355 virtual bool setDimensions(
char const* inputName,
OptProfileSelector select,
Dims const& dims)
noexcept = 0;
357 virtual int32_t getNbShapeValues(
char const* inputName)
const noexcept = 0;
358 virtual bool setExtraMemoryTarget(
float target)
noexcept = 0;
359 virtual float getExtraMemoryTarget() const noexcept = 0;
360 virtual
bool isValid() const noexcept = 0;
363 char const* inputName,
OptProfileSelector select, int64_t const* values, int32_t nbValues) noexcept
369 virtual
void setProfileStream(cudaStream_t stream) noexcept = 0;
370 TRT_NODISCARD virtual cudaStream_t getProfileStream() const noexcept = 0;
373class VCudaEngine : public VRoot
376 virtual ICudaEngine* getPImpl() noexcept = 0;
377 virtual int32_t getNbLayers() const noexcept = 0;
378 virtual IHostMemory* serialize() const noexcept = 0;
380 virtual
bool isRefittable() const noexcept = 0;
381 virtual
char const* getName() const noexcept = 0;
382 virtual int32_t getNbOptimizationProfiles() const noexcept = 0;
384 virtual
void setErrorRecorder(
IErrorRecorder* recorder) noexcept = 0;
388 virtual IEngineInspector* createEngineInspector() const noexcept = 0;
389 virtual
Dims getTensorShape(
char const* tensorName) const noexcept = 0;
390 virtual
DataType getTensorDataType(
char const* tensorName) const noexcept = 0;
391 virtual
TensorLocation getTensorLocation(
char const* tensorName) const noexcept = 0;
392 virtual
bool isShapeInferenceIO(
char const* tensorName) const noexcept = 0;
393 virtual
TensorIOMode getTensorIOMode(
char const* tensorName) const noexcept = 0;
394 virtual int32_t getTensorBytesPerComponent(
char const* tensorName) const noexcept = 0;
395 virtual int32_t getTensorComponentsPerElement(
char const* tensorName) const noexcept = 0;
396 virtual
TensorFormat getTensorFormat(
char const* tensorName) const noexcept = 0;
397 virtual
char const* getTensorFormatDesc(
char const* tensorName) const noexcept = 0;
398 virtual int32_t getTensorVectorizedDim(
char const* tensorName) const noexcept = 0;
399 virtual
Dims getProfileShape(
400 char const* tensorName, int32_t profileIndex,
OptProfileSelector select) const noexcept = 0;
401 virtual int32_t getNbIOTensors() const noexcept = 0;
402 virtual
char const* getIOTensorName(int32_t index) const noexcept = 0;
404 virtual int32_t getNbAuxStreams() const noexcept = 0;
406 virtual int32_t getTensorBytesPerComponentV2(
char const* tensorName, int32_t profileIndex) const noexcept = 0;
407 virtual int32_t getTensorComponentsPerElementV2(
char const* tensorName, int32_t profileIndex) const noexcept = 0;
408 virtual
TensorFormat getTensorFormatV2(
char const* tensorName, int32_t profileIndex) const noexcept = 0;
409 virtual
char const* getTensorFormatDescV2(
char const* tensorName, int32_t profileIndex) const noexcept = 0;
410 virtual int32_t getTensorVectorizedDimV2(
char const* tensorName, int32_t profileIndex) const noexcept = 0;
412 virtual ISerializationConfig* createSerializationConfig() noexcept = 0;
413 virtual IHostMemory* serializeWithConfig(ISerializationConfig& config) const noexcept = 0;
415 virtual IRefitter* createRefitter(
ILogger& logger) noexcept = 0;
417 virtual int64_t getStreamableWeightsSize() const noexcept = 0;
419 virtual
bool isDebugTensor(
char const* name) const noexcept = 0;
422 virtual
bool setWeightStreamingBudgetV2(int64_t gpuMemoryBudget) noexcept = 0;
423 virtual int64_t getWeightStreamingBudgetV2() const noexcept = 0;
424 virtual int64_t getWeightStreamingAutomaticBudget() const noexcept = 0;
425 virtual int64_t getWeightStreamingScratchMemorySize() const noexcept = 0;
426 virtual int64_t getDeviceMemorySizeV2() const noexcept = 0;
427 virtual int64_t getDeviceMemorySizeForProfileV2(int32_t profileIndex) const noexcept = 0;
429 TRT_NODISCARD virtual int64_t const* getProfileTensorValuesV2(
430 char const* tensorName, int32_t profileIndex,
OptProfileSelector select) const noexcept = 0;
431 TRT_NODISCARD virtual IExecutionContext* createExecutionContextWithRuntimeConfig(
432 IRuntimeConfig* runtimeConfig) noexcept = 0;
433 TRT_NODISCARD virtual IRuntimeConfig* createRuntimeConfig() noexcept = 0;
436 TRT_NODISCARD virtual
char const* getAliasedInputTensor(
char const* tensorName) const noexcept = 0;
439class VExecutionContext : public VRoot
442 virtual IExecutionContext* getPImpl() noexcept = 0;
443 virtual
void setDebugSync(
bool sync) noexcept = 0;
444 virtual
bool getDebugSync() const noexcept = 0;
445 virtual
void setProfiler(
IProfiler*) noexcept = 0;
446 virtual
IProfiler* getProfiler() const noexcept = 0;
447 virtual ICudaEngine const& getEngine() const noexcept = 0;
448 virtual
void setName(
char const* name) noexcept = 0;
449 virtual
char const* getName() const noexcept = 0;
450 virtual
void setDeviceMemory(
void* memory) noexcept = 0;
451 virtual int32_t getOptimizationProfile() const noexcept = 0;
452 virtual
bool allInputDimensionsSpecified() const noexcept = 0;
453 virtual
void setErrorRecorder(
IErrorRecorder* recorder) noexcept = 0;
455 virtual
bool executeV2(
void* const* bindings) noexcept = 0;
456 virtual
bool setOptimizationProfileAsync(int32_t profileIndex, cudaStream_t stream) noexcept = 0;
457 virtual
void setEnqueueEmitsProfile(
bool enqueueEmitsProfile) noexcept = 0;
458 virtual
bool getEnqueueEmitsProfile() const noexcept = 0;
459 virtual
bool reportToProfiler() const noexcept = 0;
460 virtual
bool setInputShape(
char const* tensorName,
Dims const& dims) noexcept = 0;
461 virtual
Dims getTensorShape(
char const* tensorName) const noexcept = 0;
462 virtual
Dims getTensorStrides(
char const* tensorName) const noexcept = 0;
463 virtual
bool setTensorAddress(
char const* tensorName,
void* data) noexcept = 0;
464 virtual
void const* getTensorAddress(
char const* tensorName) const noexcept = 0;
465 virtual
bool setInputTensorAddress(
char const* tensorName,
void const* data) noexcept = 0;
466 virtual
bool setOutputTensorAddress(
char const* tensorName,
void* data) noexcept = 0;
467 virtual int32_t inferShapes(int32_t nbMaxNames,
char const** tensorNames) noexcept = 0;
468 virtual
bool setInputConsumedEvent(cudaEvent_t event) noexcept = 0;
469 virtual cudaEvent_t getInputConsumedEvent() const noexcept = 0;
470 virtual
void* getOutputTensorAddress(
char const* tensorName) const noexcept = 0;
471 virtual
bool setOutputAllocator(
char const* tensorName,
IOutputAllocator* outputAllocator) noexcept = 0;
472 virtual
IOutputAllocator* getOutputAllocator(
char const* name) noexcept = 0;
473 virtual int64_t getMaxOutputSize(
char const* tensorName) const noexcept = 0;
474 virtual
bool setTemporaryStorageAllocator(
IGpuAllocator* allocator) noexcept = 0;
475 virtual
IGpuAllocator* getTemporaryStorageAllocator() const noexcept = 0;
476 virtual
bool enqueueV3(cudaStream_t stream) noexcept = 0;
477 virtual
void setPersistentCacheLimit(
size_t size) noexcept = 0;
478 virtual
size_t getPersistentCacheLimit() const noexcept = 0;
481 virtual
void setAuxStreams(cudaStream_t* auxStreams, int32_t nbStreams) noexcept = 0;
482 virtual
bool setDebugListener(
IDebugListener* listener) noexcept = 0;
484 virtual
bool setTensorDebugState(
char const* name,
bool flag) noexcept = 0;
485 virtual
bool getDebugState(
char const* name) const noexcept = 0;
486 virtual
bool setAllTensorsDebugState(
bool flag) noexcept = 0;
487 virtual
size_t updateDeviceMemorySizeForShapes() noexcept = 0;
488 virtual
void setDeviceMemoryV2(
void* memory, int64_t size) noexcept = 0;
489 TRT_NODISCARD virtual IRuntimeConfig* getRuntimeConfig() const noexcept = 0;
490 virtual
bool setUnfusedTensorsDebugState(
bool flag) noexcept = 0;
491 virtual
bool getUnfusedTensorsDebugState() const noexcept = 0;
492 virtual
bool setCommunicator(
void* communicator) noexcept = 0;
495class VEngineInspector : public VRoot
498 virtual IEngineInspector* getPImpl() noexcept = 0;
499 virtual
bool setExecutionContext(IExecutionContext const* context) noexcept = 0;
500 virtual IExecutionContext const* getExecutionContext() const noexcept = 0;
501 virtual
char const* getLayerInformation(int32_t layerIndex,
LayerInformationFormat format) const noexcept = 0;
503 virtual
void setErrorRecorder(
IErrorRecorder* recorder) noexcept = 0;
507class VTensor : public VRoot
510 virtual void setName(
char const* name)
noexcept = 0;
511 virtual char const* getName() const noexcept = 0;
512 virtual
void setDimensions(
Dims const& dimensions) noexcept = 0;
513 virtual
Dims getDimensions() const noexcept = 0;
514 virtual
DataType getType() const noexcept = 0;
515 virtual
bool isNetworkInput() const noexcept = 0;
516 virtual
bool isNetworkOutput() const noexcept = 0;
517 virtual
void setBroadcastAcrossBatch(
bool broadcastAcrossBatch) noexcept = 0;
518 virtual
bool getBroadcastAcrossBatch() const noexcept = 0;
521 virtual
void setAllowedFormats(
TensorFormats formats) noexcept = 0;
522 virtual
TensorFormats getAllowedFormats() const noexcept = 0;
523 virtual
bool isShapeTensor() const noexcept = 0;
524 virtual
bool isExecutionTensor() const noexcept = 0;
525 virtual
void setDimensionName(int32_t index,
char const* name) noexcept = 0;
526 virtual
char const* getDimensionName(int32_t index) const noexcept = 0;
529class VLayer : public VRoot
532 virtual LayerType getType() const noexcept = 0;
533 virtual
void setName(
char const* name) noexcept = 0;
534 virtual
char const* getName() const noexcept = 0;
535 virtual int32_t getNbInputs() const noexcept = 0;
536 virtual ITensor* getInput(int32_t index) const noexcept = 0;
537 virtual int32_t getNbOutputs() const noexcept = 0;
538 virtual ITensor* getOutput(int32_t index) const noexcept = 0;
539 virtual
void setInput(int32_t index, ITensor& tensor) noexcept = 0;
540 virtual
DataType getOutputType(int32_t index) const noexcept = 0;
541 virtual
void setMetadata(
char const* docString) noexcept = 0;
542 virtual
char const* getMetadata() const noexcept = 0;
543 virtual
bool setNbRanks(int32_t nbRanks) noexcept = 0;
544 virtual int32_t getNbRanks() const noexcept = 0;
547class VConvolutionLayer : public VRoot
550 virtual void setNbOutputMaps(int64_t nbOutputMaps)
noexcept = 0;
551 virtual int64_t getNbOutputMaps() const noexcept = 0;
552 virtual
void setNbGroups(int64_t nbGroups) noexcept = 0;
553 virtual int64_t getNbGroups() const noexcept = 0;
554 virtual
void setKernelWeights(Weights weights) noexcept = 0;
555 virtual Weights getKernelWeights() const noexcept = 0;
556 virtual
void setBiasWeights(Weights weights) noexcept = 0;
557 virtual Weights getBiasWeights() const noexcept = 0;
558 virtual
void setPrePadding(
Dims const& padding) noexcept = 0;
559 virtual
Dims getPrePadding() const noexcept = 0;
560 virtual
void setPostPadding(
Dims const& padding) noexcept = 0;
561 virtual
Dims getPostPadding() const noexcept = 0;
562 virtual
void setPaddingMode(
PaddingMode paddingMode) noexcept = 0;
563 virtual
PaddingMode getPaddingMode() const noexcept = 0;
564 virtual
void setKernelSizeNd(
Dims const& kernelSize) noexcept = 0;
565 virtual
Dims getKernelSizeNd() const noexcept = 0;
566 virtual
void setStrideNd(
Dims const& stride) noexcept = 0;
567 virtual
Dims getStrideNd() const noexcept = 0;
568 virtual
void setPaddingNd(
Dims const& padding) noexcept = 0;
569 virtual
Dims getPaddingNd() const noexcept = 0;
570 virtual
void setDilationNd(
Dims const& dilation) noexcept = 0;
571 virtual
Dims getDilationNd() const noexcept = 0;
574class VActivationLayer : public VRoot
579 virtual
void setAlpha(
float alpha) noexcept = 0;
580 virtual
void setBeta(
float beta) noexcept = 0;
581 virtual
float getAlpha() const noexcept = 0;
582 virtual
float getBeta() const noexcept = 0;
585class VPoolingLayer : public VRoot
588 virtual void setPoolingType(
PoolingType type)
noexcept = 0;
589 virtual PoolingType getPoolingType() const noexcept = 0;
590 virtual
void setBlendFactor(
float blendFactor) noexcept = 0;
591 virtual
float getBlendFactor() const noexcept = 0;
592 virtual
void setAverageCountExcludesPadding(
bool exclusive) noexcept = 0;
593 virtual
bool getAverageCountExcludesPadding() const noexcept = 0;
594 virtual
void setPrePadding(
Dims const& padding) noexcept = 0;
595 virtual
Dims getPrePadding() const noexcept = 0;
596 virtual
void setPostPadding(
Dims const& padding) noexcept = 0;
597 virtual
Dims getPostPadding() const noexcept = 0;
598 virtual
void setPaddingMode(
PaddingMode paddingMode) noexcept = 0;
599 virtual
PaddingMode getPaddingMode() const noexcept = 0;
600 virtual
void setWindowSizeNd(
Dims const& windowSize) noexcept = 0;
601 virtual
Dims getWindowSizeNd() const noexcept = 0;
602 virtual
void setStrideNd(
Dims const& stride) noexcept = 0;
603 virtual
Dims getStrideNd() const noexcept = 0;
604 virtual
void setPaddingNd(
Dims const& padding) noexcept = 0;
605 virtual
Dims getPaddingNd() const noexcept = 0;
608class VLRNLayer : public VRoot
611 virtual void setWindowSize(int64_t windowSize)
noexcept = 0;
612 virtual int64_t getWindowSize() const noexcept = 0;
613 virtual
void setAlpha(
float alpha) noexcept = 0;
614 virtual
float getAlpha() const noexcept = 0;
615 virtual
void setBeta(
float beta) noexcept = 0;
616 virtual
float getBeta() const noexcept = 0;
617 virtual
void setK(
float k) noexcept = 0;
618 virtual
float getK() const noexcept = 0;
621class VScaleLayer : public VRoot
624 virtual void setMode(
ScaleMode mode)
noexcept = 0;
625 virtual ScaleMode getMode() const noexcept = 0;
626 virtual
void setShift(Weights shift) noexcept = 0;
627 virtual Weights getShift() const noexcept = 0;
628 virtual
void setScale(Weights scale) noexcept = 0;
629 virtual Weights getScale() const noexcept = 0;
630 virtual
void setPower(Weights power) noexcept = 0;
631 virtual Weights getPower() const noexcept = 0;
632 virtual int32_t getChannelAxis() const noexcept = 0;
633 virtual
void setChannelAxis(int32_t channelAxis) noexcept = 0;
636class VSoftMaxLayer : public VRoot
639 virtual void setAxes(uint32_t axes)
noexcept = 0;
640 virtual uint32_t getAxes() const noexcept = 0;
643class VConcatenationLayer : public VRoot
646 virtual void setAxis(int32_t axis)
noexcept = 0;
647 virtual int32_t getAxis() const noexcept = 0;
650class VDeconvolutionLayer : public VRoot
653 virtual void setNbOutputMaps(int64_t nbOutputMaps)
noexcept = 0;
654 virtual int64_t getNbOutputMaps() const noexcept = 0;
655 virtual
void setNbGroups(int64_t nbGroups) noexcept = 0;
656 virtual int64_t getNbGroups() const noexcept = 0;
657 virtual
void setKernelWeights(Weights weights) noexcept = 0;
658 virtual Weights getKernelWeights() const noexcept = 0;
659 virtual
void setBiasWeights(Weights weights) noexcept = 0;
660 virtual Weights getBiasWeights() const noexcept = 0;
661 virtual
void setPrePadding(
Dims const& padding) noexcept = 0;
662 virtual
Dims getPrePadding() const noexcept = 0;
663 virtual
void setPostPadding(
Dims const& padding) noexcept = 0;
664 virtual
Dims getPostPadding() const noexcept = 0;
665 virtual
void setPaddingMode(
PaddingMode paddingMode) noexcept = 0;
666 virtual
PaddingMode getPaddingMode() const noexcept = 0;
667 virtual
void setKernelSizeNd(
Dims const& kernelSize) noexcept = 0;
668 virtual
Dims getKernelSizeNd() const noexcept = 0;
669 virtual
void setStrideNd(
Dims const& stride) noexcept = 0;
670 virtual
Dims getStrideNd() const noexcept = 0;
671 virtual
void setPaddingNd(
Dims const& padding) noexcept = 0;
672 virtual
Dims getPaddingNd() const noexcept = 0;
673 virtual
void setDilationNd(
Dims const& dilation) noexcept = 0;
674 virtual
Dims getDilationNd() const noexcept = 0;
677class VElementWiseLayer : public VRoot
684class VGatherLayer : public VRoot
687 virtual void setGatherAxis(int32_t axis)
noexcept = 0;
688 virtual int32_t getGatherAxis() const noexcept = 0;
689 virtual
void setNbElementWiseDims(int32_t k) noexcept = 0;
690 virtual int32_t getNbElementWiseDims() const noexcept = 0;
691 virtual
void setMode(
GatherMode mode) noexcept = 0;
692 virtual
GatherMode getMode() const noexcept = 0;
695class VPluginLayer : public VRoot
698 virtual IPlugin& getPlugin() noexcept = 0;
701class VPluginV2Layer : public VRoot
704 virtual IPluginV2& getPlugin() noexcept = 0;
707class VPluginV3Layer : public VRoot
710 virtual IPluginV3& getPlugin() noexcept = 0;
713class VUnaryLayer : public VRoot
720class VReduceLayer : public VRoot
725 virtual
void setReduceAxes(uint32_t reduceAxes) noexcept = 0;
726 virtual uint32_t getReduceAxes() const noexcept = 0;
727 virtual
void setKeepDimensions(
bool keepDimensions) noexcept = 0;
728 virtual
bool getKeepDimensions() const noexcept = 0;
731class VPaddingLayer : public VRoot
734 virtual void setPrePaddingNd(
Dims const& padding)
noexcept = 0;
735 virtual Dims getPrePaddingNd() const noexcept = 0;
736 virtual
void setPostPaddingNd(
Dims const& padding) noexcept = 0;
737 virtual
Dims getPostPaddingNd() const noexcept = 0;
740class VShuffleLayer : public VRoot
743 virtual void setFirstTranspose(Permutation
const& permutation)
noexcept = 0;
744 virtual Permutation
const& getFirstTranspose() const noexcept = 0;
745 virtual
void setReshapeDimensions(
Dims const& dimensions) noexcept = 0;
746 virtual
Dims getReshapeDimensions() const noexcept = 0;
747 virtual
void setSecondTranspose(Permutation const& permutation) noexcept = 0;
748 virtual Permutation const& getSecondTranspose() const noexcept = 0;
749 virtual
void setZeroIsPlaceholder(
bool zeroIsPlaceholder) noexcept = 0;
750 virtual
bool getZeroIsPlaceholder() const noexcept = 0;
753class VSliceLayer : public VRoot
756 virtual void setStart(
Dims const& start)
noexcept = 0;
757 virtual Dims getStart() const noexcept = 0;
758 virtual
void setSize(
Dims const& size) noexcept = 0;
759 virtual
Dims getSize() const noexcept = 0;
760 virtual
void setStride(
Dims const& stride) noexcept = 0;
761 virtual
Dims getStride() const noexcept = 0;
762 virtual
void setMode(
SampleMode mode) noexcept = 0;
763 virtual
SampleMode getMode() const noexcept = 0;
764 virtual
void setAxes(
Dims const& axes) noexcept = 0;
765 virtual
Dims getAxes() const noexcept = 0;
768class VShapeLayer : public VRoot
773class VTopKLayer :
public VRoot
778 virtual
void setK(int32_t k) noexcept = 0;
779 virtual int32_t getK() const noexcept = 0;
780 virtual
void setReduceAxes(uint32_t reduceAxes) noexcept = 0;
781 virtual uint32_t getReduceAxes() const noexcept = 0;
782 virtual
bool setIndicesType(
DataType type) noexcept = 0;
783 virtual
DataType getIndicesType() const noexcept = 0;
786class VMatrixMultiplyLayer : public VRoot
789 virtual void setOperation(int32_t index,
MatrixOperation op)
noexcept = 0;
790 virtual MatrixOperation getOperation(int32_t index)
const noexcept = 0;
793class VNonZeroLayer :
public VRoot
796 virtual bool setIndicesType(
DataType type)
noexcept = 0;
797 virtual DataType getIndicesType() const noexcept = 0;
800class VRaggedSoftMaxLayer : public VRoot
805class VIdentityLayer :
public VRoot
810class VCastLayer :
public VRoot
813 virtual void setToType(
DataType toType)
noexcept = 0;
814 virtual DataType getToType() const noexcept = 0;
817class VConstantLayer : public VRoot
820 virtual void setWeights(Weights weights)
noexcept = 0;
821 virtual Weights getWeights() const noexcept = 0;
822 virtual
void setDimensions(
Dims const& dimensions) noexcept = 0;
823 virtual
Dims getDimensions() const noexcept = 0;
826class VParametricReLULayer : public VRoot
831class VResizeLayer :
public VRoot
834 virtual void setOutputDimensions(
Dims const& dimensions)
noexcept = 0;
835 virtual Dims getOutputDimensions() const noexcept = 0;
836 virtual
void setScales(
float const* scales, int32_t nbScales) noexcept = 0;
837 virtual int32_t getScales(int32_t size,
float* scales) const noexcept = 0;
842 virtual
void setSelectorForSinglePixel(
ResizeSelector selector) noexcept = 0;
843 virtual
ResizeSelector getSelectorForSinglePixel() const noexcept = 0;
846 virtual
void setCubicCoeff(
float value) noexcept = 0;
847 virtual
float getCubicCoeff() const noexcept = 0;
848 virtual
void setExcludeOutside(
bool value) noexcept = 0;
849 virtual
bool getExcludeOutside() const noexcept = 0;
852class VLoopBoundaryLayer : public VRoot
855 virtual ILoop* getLoop() const noexcept = 0;
858class VRecurrenceLayer : public VRoot
863class VLoopOutputLayer :
public VRoot
866 virtual LoopOutput getLoopOutput() const noexcept = 0;
867 virtual
void setAxis(int32_t axis) noexcept = 0;
868 virtual int32_t getAxis() const noexcept = 0;
871class VTripLimitLayer : public VRoot
874 virtual TripLimit getTripLimit() const noexcept = 0;
877class VIteratorLayer : public VRoot
880 virtual void setAxis(int32_t axis)
noexcept = 0;
881 virtual int32_t getAxis() const noexcept = 0;
882 virtual
void setReverse(
bool reverse) noexcept = 0;
883 virtual
bool getReverse() const noexcept = 0;
885class VLoop : public VRoot
888 virtual IRecurrenceLayer* addRecurrence(ITensor& initialValue)
noexcept = 0;
889 virtual ITripLimitLayer* addTripLimit(ITensor& tensor,
TripLimit limit)
noexcept = 0;
890 virtual IIteratorLayer* addIterator(ITensor& tensor, int32_t axis = 0,
bool reverse =
false) noexcept = 0;
891 virtual ILoopOutputLayer* addLoopOutput(ITensor& tensor,
LoopOutput outputKind, int32_t axis = 0) noexcept = 0;
892 virtual
void setName(
char const* name) noexcept = 0;
893 virtual
char const* getName() const noexcept = 0;
896class VConditionalBoundaryLayer : public VRoot
899 virtual IIfConditional* getConditional() const noexcept = 0;
902class VConditionLayer : public VRoot
907class VConditionalInputLayer :
public VRoot
912class VConditionalOutputLayer :
public VRoot
917class VIfConditional :
public VRoot
920 virtual IConditionLayer* setCondition(ITensor& tensor)
noexcept = 0;
921 virtual IIfConditionalInputLayer* addInput(ITensor& tensor)
noexcept = 0;
922 virtual IIfConditionalOutputLayer* addOutput(ITensor& trueTensor, ITensor& falseTensor)
noexcept = 0;
923 virtual void setName(
char const* name)
noexcept = 0;
924 virtual char const* getName() const noexcept = 0;
927class VAttentionBoundaryLayer : public VRoot
930 virtual IAttention* getAttention() const noexcept = 0;
933class VAttentionInputLayer : public VRoot
938class VAttentionOutputLayer :
public VRoot
943class VAttention :
public VRoot
946 TRT_NODISCARD virtual bool setInput(int32_t index, ITensor& input)
noexcept = 0;
947 TRT_NODISCARD virtual int32_t getNbInputs() const noexcept = 0;
948 TRT_NODISCARD virtual ITensor* getInput(int32_t index) const noexcept = 0;
949 TRT_NODISCARD virtual int32_t getNbOutputs() const noexcept = 0;
950 TRT_NODISCARD virtual ITensor* getOutput(int32_t index) const noexcept = 0;
951 TRT_NODISCARD virtual
bool setName(
char const* name) noexcept = 0;
952 TRT_NODISCARD virtual
char const* getName() const noexcept = 0;
955 TRT_DEPRECATED virtual
bool setCausal(
bool isCausal) noexcept = 0;
957 TRT_NODISCARD virtual
bool setMask(ITensor& mask) noexcept = 0;
959 TRT_NODISCARD virtual
bool setDecomposable(
bool decomposable) noexcept = 0;
960 TRT_NODISCARD virtual
bool getDecomposable() const noexcept = 0;
961 TRT_NODISCARD virtual
bool setNormalizationQuantizeScale(ITensor& tensor) noexcept = 0;
962 TRT_NODISCARD virtual ITensor* getNormalizationQuantizeScale() const noexcept = 0;
965 TRT_NODISCARD virtual
bool setMetadata(
char const* docString) noexcept = 0;
966 TRT_NODISCARD virtual
char const* getMetadata() const noexcept = 0;
967 TRT_NODISCARD virtual
bool setNbRanks(int32_t nbRanks) noexcept = 0;
968 TRT_NODISCARD virtual int32_t getNbRanks() const noexcept = 0;
975 TRT_NODISCARD virtual
bool setQueryLengths(ITensor* lengths) noexcept = 0;
976 TRT_NODISCARD virtual ITensor* getQueryLengths() const noexcept = 0;
977 TRT_NODISCARD virtual
bool setKeyValueLengths(ITensor* lengths) noexcept = 0;
978 TRT_NODISCARD virtual ITensor* getKeyValueLengths() const noexcept = 0;
981class VSelectLayer : public VRoot
985class VAssertionLayer :
public VRoot
988 virtual void setMessage(
char const* message)
noexcept = 0;
989 virtual char const* getMessage() const noexcept = 0;
992class VFillLayer : public VRoot
995 virtual void setDimensions(
Dims const& dimensions)
noexcept = 0;
996 virtual Dims getDimensions() const noexcept = 0;
999 virtual
void setAlpha(
double alpha) noexcept = 0;
1000 virtual
double getAlpha() const noexcept = 0;
1001 virtual
void setBeta(
double beta) noexcept = 0;
1002 virtual
double getBeta() const noexcept = 0;
1003 virtual
void setAlphaInt64(int64_t alpha) noexcept = 0;
1004 virtual int64_t getAlphaInt64() const noexcept = 0;
1005 virtual
void setBetaInt64(int64_t beta) noexcept = 0;
1006 virtual int64_t getBetaInt64() const noexcept = 0;
1007 virtual
bool isAlphaBetaInt64() const noexcept = 0;
1008 virtual
DataType getToType() const noexcept = 0;
1009 virtual
void setToType(
DataType toType) noexcept = 0;
1012class VQuantizeLayer : public VRoot
1015 virtual int32_t getAxis() const noexcept = 0;
1016 virtual
void setAxis(int32_t axis) noexcept = 0;
1017 virtual
DataType getToType() const noexcept = 0;
1018 virtual
void setToType(
DataType toType) noexcept = 0;
1019 virtual
Dims getBlockShape() const noexcept = 0;
1020 virtual
bool setBlockShape(
Dims const& blockShape) noexcept = 0;
1023class VDequantizeLayer : public VRoot
1026 virtual int32_t getAxis() const noexcept = 0;
1027 virtual
void setAxis(int32_t axis) noexcept = 0;
1028 virtual
DataType getToType() const noexcept = 0;
1029 virtual
void setToType(
DataType toType) noexcept = 0;
1030 virtual
Dims getBlockShape() const noexcept = 0;
1031 virtual
bool setBlockShape(
Dims const& blockShape) noexcept = 0;
1034class VDynamicQuantizeLayer : public VRoot
1039 TRT_DEPRECATED virtual int32_t getBlockSize() const noexcept = 0;
1040 TRT_DEPRECATED virtual
void setBlockSize(int32_t axis) noexcept = 0;
1041 virtual
DataType getScaleType() const noexcept = 0;
1042 virtual
void setScaleType(
DataType axis) noexcept = 0;
1043 virtual
DataType getToType() const noexcept = 0;
1044 virtual
void setToType(
DataType toType) noexcept = 0;
1045 virtual
Dims getBlockShape() const noexcept = 0;
1046 virtual
void setBlockShape(
Dims const& blockShape) noexcept = 0;
1049class VScatterLayer : public VRoot
1052 virtual void setMode(
ScatterMode mode)
noexcept = 0;
1054 virtual
void setAxis(int32_t axis) noexcept = 0;
1055 virtual int32_t getAxis() const noexcept = 0;
1058class VEinsumLayer : public VRoot
1061 virtual bool setEquation(
char const* equation)
noexcept = 0;
1062 virtual char const* getEquation() const noexcept = 0;
1065class VOneHotLayer : public VRoot
1068 virtual int32_t getAxis() const noexcept = 0;
1069 virtual
void setAxis(int32_t axis) noexcept = 0;
1072class VGridSampleLayer : public VRoot
1077 virtual
void setAlignCorners(
bool alignCorners) noexcept = 0;
1078 virtual
bool getAlignCorners() const noexcept = 0;
1079 virtual
bool setSampleMode(
SampleMode mode) noexcept = 0;
1080 virtual
SampleMode getSampleMode() const noexcept = 0;
1083class VNMSLayer : public VRoot
1088 virtual
void setTopKBoxLimit(int32_t limit) noexcept = 0;
1089 virtual int32_t getTopKBoxLimit() const noexcept = 0;
1090 virtual
bool setIndicesType(
DataType type) noexcept = 0;
1091 virtual
DataType getIndicesType() const noexcept = 0;
1094class VReverseSequenceLayer : public VRoot
1097 virtual void setBatchAxis(int32_t batchAxis)
noexcept = 0;
1098 virtual int32_t getBatchAxis() const noexcept = 0;
1100 virtual
void setSequenceAxis(int32_t sequenceAxis) noexcept = 0;
1101 virtual int32_t getSequenceAxis() const noexcept = 0;
1104class VNormalizationLayer : public VRoot
1107 virtual void setEpsilon(
float eps)
noexcept = 0;
1108 virtual float getEpsilon() const noexcept = 0;
1109 virtual
void setAxes(uint32_t axesMask) noexcept = 0;
1110 virtual uint32_t getAxes() const noexcept = 0;
1111 virtual
void setNbGroups(int64_t nbGroups) noexcept = 0;
1112 virtual int64_t getNbGroups() const noexcept = 0;
1113 virtual
bool isV2() const noexcept = 0;
1116class VSqueezeLayer : public VRoot
1120class VUnsqueezeLayer :
public VRoot
1124class VCumulativeLayer :
public VRoot
1129 virtual
void setExclusive(
bool exclusive) noexcept = 0;
1130 virtual
bool getExclusive() const noexcept = 0;
1131 virtual
void setReverse(
bool reverse) noexcept = 0;
1132 virtual
bool getReverse() const noexcept = 0;
1135class VRotaryEmbeddingLayer : public VRoot
1138 virtual void setInterleaved(
bool interleaved)
noexcept = 0;
1139 virtual bool getInterleaved() const noexcept = 0;
1140 virtual
bool setRotaryEmbeddingDim(int32_t rotaryEmbeddingDim) noexcept = 0;
1141 virtual int32_t getRotaryEmbeddingDim() const noexcept = 0;
1142 virtual
void setInput(int32_t index, ITensor& input) noexcept = 0;
1145class VKVCacheUpdateLayer : public VRoot
1152 TRT_NODISCARD virtual
bool setUpdateLengths(ITensor* lengths) noexcept = 0;
1153 TRT_NODISCARD virtual ITensor* getUpdateLengths() const noexcept = 0;
1156class VMoELayer : public VRoot
1159 virtual void setGatedWeights(ITensor& fcGateWeights, ITensor& fcUpWeights, ITensor& fcDownWeights,
MoEActType activationType)
noexcept = 0;
1160 virtual void setGatedBiases(ITensor& fcGateBiases, ITensor& fcUpBiases, ITensor& fcDownBiases)
noexcept = 0;
1161 virtual void setActivationType(
MoEActType activationType)
noexcept = 0;
1162 virtual MoEActType getActivationType() const noexcept = 0;
1163 virtual
void setQuantizationStatic(ITensor& fcDownActivationScale,
DataType dataType) noexcept = 0;
1164 virtual
void setQuantizationDynamicDblQ(ITensor& fcDownActivationDblQScale,
DataType dataType,
Dims const& blockShape,
DataType dynQOutputScaleType) noexcept = 0;
1165 virtual
void setQuantizationToType(
DataType type) noexcept = 0;
1166 virtual
DataType getQuantizationToType() const noexcept = 0;
1167 virtual
void setQuantizationBlockShape(
Dims const& blockShape) noexcept = 0;
1168 virtual
Dims getQuantizationBlockShape() const noexcept = 0;
1169 virtual
void setDynQOutputScaleType(
DataType type) noexcept = 0;
1170 virtual
DataType getDynQOutputScaleType() const noexcept = 0;
1171 virtual
void setSwigluParams(
float limit,
float alpha,
float beta) noexcept = 0;
1172 virtual
void setSwigluParamLimit(
float limit) noexcept = 0;
1173 virtual
float getSwigluParamLimit() const noexcept = 0;
1174 virtual
void setSwigluParamAlpha(
float alpha) noexcept = 0;
1175 virtual
float getSwigluParamAlpha() const noexcept = 0;
1176 virtual
void setSwigluParamBeta(
float beta) noexcept = 0;
1177 virtual
float getSwigluParamBeta() const noexcept = 0;
1178 virtual
void setInput(int32_t index, ITensor& tensor) noexcept = 0;
1182class VNetworkDefinition : public VRoot
1185 virtual ITensor* addInput(
char const* name,
DataType type,
Dims const& dimensions)
noexcept = 0;
1186 virtual void markOutput(ITensor& tensor)
noexcept = 0;
1187 virtual IActivationLayer* addActivation(ITensor& input,
ActivationType type)
noexcept = 0;
1188 virtual ILRNLayer* addLRN(ITensor& input, int64_t window,
float alpha,
float beta,
float k)
noexcept = 0;
1189 virtual IScaleLayer* addScale(
1190 ITensor& input,
ScaleMode mode, Weights shift, Weights scale, Weights power)
noexcept = 0;
1191 virtual ISoftMaxLayer* addSoftMax(ITensor& input)
noexcept = 0;
1192 virtual IConcatenationLayer* addConcatenation(ITensor*
const* inputs, int32_t nbInputs)
noexcept = 0;
1193 virtual IElementWiseLayer* addElementWise(ITensor& input1, ITensor& input2,
ElementWiseOperation op)
noexcept = 0;
1194 virtual IUnaryLayer* addUnary(ITensor& input,
UnaryOperation operation)
noexcept = 0;
1195 virtual IShuffleLayer* addShuffle(ITensor& input)
noexcept = 0;
1196 virtual int32_t getNbLayers() const noexcept = 0;
1197 virtual ILayer* getLayer(int32_t index) const noexcept = 0;
1198 virtual int32_t getNbInputs() const noexcept = 0;
1199 virtual ITensor* getInput(int32_t index) const noexcept = 0;
1200 virtual int32_t getNbOutputs() const noexcept = 0;
1201 virtual ITensor* getOutput(int32_t index) const noexcept = 0;
1202 virtual IReduceLayer* addReduce(
1203 ITensor& input,
ReduceOperation operation, uint32_t reduceAxes,
bool keepDimensions) noexcept
1205 virtual ITopKLayer* addTopK(ITensor& input,
TopKOperation op, int32_t k, uint32_t reduceAxes) noexcept = 0;
1206 virtual IGatherLayer* addGather(ITensor& data, ITensor& indices, int32_t axis) noexcept = 0;
1207 virtual IRaggedSoftMaxLayer* addRaggedSoftMax(ITensor& input, ITensor& bounds) noexcept = 0;
1208 virtual IMatrixMultiplyLayer* addMatrixMultiply(
1210 virtual IConstantLayer* addConstant(
Dims const& dimensions, Weights weights) noexcept = 0;
1211 virtual IIdentityLayer* addIdentity(ITensor& input) noexcept = 0;
1212 virtual
void removeTensor(ITensor& tensor) noexcept = 0;
1213 virtual
void unmarkOutput(ITensor& tensor) noexcept = 0;
1214 virtual IPluginV2Layer* addPluginV2(ITensor* const* inputs, int32_t nbInputs, IPluginV2& plugin) noexcept = 0;
1215 virtual IPluginV3Layer* addPluginV3(ITensor* const* inputs, int32_t nbInputs, ITensor* const* shapeInputs,
1216 int32_t nbShapeInputs,
IPluginV3& plugin) noexcept = 0;
1217 virtual ISliceLayer* addSlice(ITensor& input,
Dims const& start,
Dims const& size,
Dims const& stride) noexcept = 0;
1218 virtual
void setName(
char const* name) noexcept = 0;
1219 virtual
char const* getName() const noexcept = 0;
1220 virtual IShapeLayer* addShape(ITensor& input) noexcept = 0;
1221 virtual
bool hasImplicitBatchDimension() const noexcept = 0;
1222 virtual
bool markOutputForShapes(ITensor& tensor) noexcept = 0;
1223 virtual
bool unmarkOutputForShapes(ITensor& tensor) noexcept = 0;
1224 virtual IParametricReLULayer* addParametricReLU(ITensor& input, ITensor& slope) noexcept = 0;
1225 virtual IConvolutionLayer* addConvolutionNd(
1226 ITensor& input, int64_t nbOutputMaps,
Dims const& kernelSize, Weights kernelWeights, Weights biasWeights) noexcept
1228 virtual IPoolingLayer* addPoolingNd(ITensor& input,
PoolingType type,
Dims const& windowSize) noexcept = 0;
1229 virtual IDeconvolutionLayer* addDeconvolutionNd(
1230 ITensor& input, int64_t nbOutputMaps,
Dims const& kernelSize, Weights kernelWeights, Weights biasWeights) noexcept
1232 virtual IScaleLayer* addScaleNd(
1233 ITensor& input,
ScaleMode mode, Weights shift, Weights scale, Weights power, int32_t channelAxis) noexcept = 0;
1234 virtual IResizeLayer* addResize(ITensor& input) noexcept = 0;
1235 virtual ILoop* addLoop() noexcept = 0;
1236 virtual ISelectLayer* addSelect(ITensor& condition, ITensor& thenInput, ITensor& elseInput) noexcept = 0;
1237 virtual IPaddingLayer* addPaddingNd(ITensor& input,
Dims const& prePadding,
Dims const& postPadding) noexcept = 0;
1238 virtual
bool setWeightsName(Weights weights,
char const* name) noexcept = 0;
1239 virtual
void setErrorRecorder(
IErrorRecorder* recorder) noexcept = 0;
1241 virtual IGatherLayer* addGatherV2(ITensor& data, ITensor& indices,
GatherMode mode) noexcept = 0;
1242 virtual IIfConditional* addIfConditional() noexcept = 0;
1243 virtual IScatterLayer* addScatter(ITensor& data, ITensor& indices, ITensor& updates,
ScatterMode mode) noexcept = 0;
1244 virtual IEinsumLayer* addEinsum(ITensor* const* inputs, int32_t nbInputs,
char const* equation) noexcept = 0;
1245 virtual IAssertionLayer* addAssertion(ITensor& condition,
char const* message) noexcept = 0;
1246 virtual IOneHotLayer* addOneHot(ITensor& indices, ITensor& values, ITensor& depth, int32_t axis) noexcept = 0;
1247 virtual INonZeroLayer* addNonZero(ITensor& input) noexcept = 0;
1248 virtual IGridSampleLayer* addGridSample(ITensor& input, ITensor& grid) noexcept = 0;
1249 virtual INMSLayer* addNMS(ITensor& boxes, ITensor& scores, ITensor& maxOutputBoxesPerClass) noexcept = 0;
1250 virtual IReverseSequenceLayer* addReverseSequence(ITensor& input, ITensor& sequenceLens) noexcept = 0;
1251 virtual INormalizationLayer* addNormalization(
1252 ITensor& input, ITensor& scale, ITensor& bias, uint32_t axesMask) noexcept = 0;
1253 virtual ICastLayer* addCast(ITensor& input,
DataType toType) noexcept = 0;
1254 virtual IBuilder& getBuilder() const noexcept = 0;
1257 virtual IQuantizeLayer* addQuantizeV2(ITensor& input, ITensor& scale,
DataType outputType) noexcept = 0;
1258 virtual IDequantizeLayer* addDequantizeV2(ITensor& input, ITensor& scale,
DataType outputType) noexcept = 0;
1260 virtual
bool markDebug(ITensor& tensor) noexcept = 0;
1261 virtual
bool unmarkDebug(ITensor& tensor) noexcept = 0;
1262 virtual
bool isDebugTensor(ITensor const& tensor) const noexcept = 0;
1263 virtual
bool markWeightsRefittable(
char const* name) noexcept = 0;
1264 virtual
bool unmarkWeightsRefittable(
char const* name) noexcept = 0;
1265 virtual
bool areWeightsMarkedRefittable(
char const* name) const noexcept = 0;
1266 virtual ISqueezeLayer* addSqueeze(ITensor& input, ITensor& axes) noexcept = 0;
1267 virtual IUnsqueezeLayer* addUnsqueeze(ITensor& input, ITensor& axes) noexcept = 0;
1268 virtual IDynamicQuantizeLayer* addDynamicQuantize(
1269 ITensor& input, int32_t axis, int32_t blockSize,
DataType toType,
DataType scaleType) noexcept = 0;
1270 virtual ICumulativeLayer* addCumulative(
1271 ITensor& input, ITensor& axis,
CumulativeOperation operation,
bool exclusive,
bool reverse) noexcept = 0;
1272 virtual
bool markUnfusedTensorsAsDebugTensors() noexcept = 0;
1273 virtual
bool unmarkUnfusedTensorsAsDebugTensors() noexcept = 0;
1274 virtual ITopKLayer* addTopKV2(
1275 ITensor& input,
TopKOperation op, int32_t k, uint32_t reduceAxes,
DataType indicesType) noexcept = 0;
1276 virtual INonZeroLayer* addNonZeroV2(ITensor& input,
DataType indicesType) noexcept = 0;
1277 virtual INMSLayer* addNMSV2(
1278 ITensor& boxes, ITensor& scores, ITensor& maxOutputBoxesPerClass,
DataType indicesType) noexcept = 0;
1281 virtual IRotaryEmbeddingLayer* addRotaryEmbedding(ITensor& input, ITensor& cosCache, ITensor& sinCache,
1282 bool interleaved, int32_t rotaryEmbeddingDim) noexcept = 0;
1283 virtual IDynamicQuantizeLayer* addDynamicQuantizeV2(
1285 virtual IKVCacheUpdateLayer* addKVCacheUpdate(
1286 ITensor& cache, ITensor& update, ITensor& writeIndices,
KVCacheMode cacheMode) noexcept = 0;
1287 virtual INormalizationLayer* addNormalizationV2(
1288 ITensor& input, ITensor& scale, ITensor& bias, uint32_t axesMask) noexcept = 0;
1289 virtual IMoELayer* addMoE(
1290 ITensor& hiddenStates, ITensor& selectedExpertsForTokens, ITensor& scoresForSelectedExperts) noexcept = 0;
1291 virtual IDistCollectiveLayer* addDistCollective(ITensor& input,
CollectiveOperation distCollectiveOp,
1292 ReduceOperation reduceOp, int64_t root, int64_t* groups, int64_t groupSize) noexcept = 0;
1295 virtual ISqueezeLayer* addSqueezeV2(ITensor& input, ITensor* axes) noexcept = 0;
1298class VTimingCache : public VRoot
1302 virtual
bool combine(ITimingCache const& inputCache,
bool ignoreMismatch) noexcept = 0;
1303 virtual
bool reset() noexcept = 0;
1304 virtual int64_t queryKeys(TimingCacheKey* keyBuffer, int64_t capacity) const noexcept = 0;
1305 virtual TimingCacheValue query(TimingCacheKey const& key) const noexcept = 0;
1306 virtual
bool update(TimingCacheKey const& key, TimingCacheValue const& value) noexcept = 0;
1310class VBuilderConfig : public VRoot
1313 virtual void setAvgTimingIterations(int32_t avgTiming)
noexcept = 0;
1314 virtual int32_t getAvgTimingIterations() const noexcept = 0;
1315 virtual
void setEngineCapability(
EngineCapability capability) noexcept = 0;
1317 virtual
void setFlags(
BuilderFlags builderFlags) noexcept = 0;
1319 virtual
void clearFlag(
BuilderFlag builderFlag) noexcept = 0;
1320 virtual
void setFlag(
BuilderFlag builderFlag) noexcept = 0;
1321 virtual
bool getFlag(
BuilderFlag builderFlag) const noexcept = 0;
1322 virtual
void setDeviceType(ILayer const* layer,
DeviceType deviceType) noexcept = 0;
1323 virtual
DeviceType getDeviceType(ILayer const* layer) const noexcept = 0;
1324 virtual
bool isDeviceTypeSet(ILayer const* layer) const noexcept = 0;
1325 virtual
void resetDeviceType(ILayer const* layer) noexcept = 0;
1326 virtual
bool canRunOnDLA(ILayer const* layer) const noexcept = 0;
1327 virtual
void setDLACore(int32_t dlaCore) noexcept = 0;
1328 virtual int32_t getDLACore() const noexcept = 0;
1329 virtual
void setDefaultDeviceType(
DeviceType deviceType) noexcept = 0;
1330 virtual
DeviceType getDefaultDeviceType() const noexcept = 0;
1331 virtual
void reset() noexcept = 0;
1332 virtual
void setProfileStream(const cudaStream_t stream) noexcept = 0;
1333 virtual cudaStream_t getProfileStream() const noexcept = 0;
1334 virtual int32_t addOptimizationProfile(IOptimizationProfile const* profile) noexcept = 0;
1335 virtual int32_t getNbOptimizationProfiles() const noexcept = 0;
1338 virtual
bool setTacticSources(
TacticSources tacticSources) noexcept = 0;
1339 virtual
TacticSources getTacticSources() const noexcept = 0;
1340 virtual
nvinfer1::ITimingCache* createTimingCache(
void const* blob, std::
size_t size) const noexcept = 0;
1341 virtual
bool setTimingCache(ITimingCache const& cache,
bool ignoreMismatch) noexcept = 0;
1342 virtual
nvinfer1::ITimingCache const* getTimingCache() const noexcept = 0;
1343 virtual
void setMemoryPoolLimit(
MemoryPoolType pool, std::
size_t poolSize) noexcept = 0;
1344 virtual std::
size_t getMemoryPoolLimit(
MemoryPoolType pool) const noexcept = 0;
1345 virtual
void setPreviewFeature(
PreviewFeature feature,
bool enable) noexcept = 0;
1346 virtual
bool getPreviewFeature(
PreviewFeature feature) const noexcept = 0;
1347 virtual
void setBuilderOptimizationLevel(int32_t level) noexcept = 0;
1348 virtual int32_t getBuilderOptimizationLevel() const noexcept = 0;
1351 virtual
void setPluginsToSerialize(
char const* const* paths, int32_t nbPaths) noexcept = 0;
1352 virtual
char const* getPluginToSerialize(int32_t index) const noexcept = 0;
1353 virtual int32_t getNbPluginsToSerialize() const noexcept = 0;
1354 virtual
bool setMaxAuxStreams(int32_t nbStreams) noexcept = 0;
1355 virtual int32_t getMaxAuxStreams() const noexcept = 0;
1358 virtual
void setRuntimePlatform(
RuntimePlatform runtimePlatform) noexcept = 0;
1360 virtual
void setMaxNbTactics(int32_t maxTactics) noexcept = 0;
1361 virtual int32_t getMaxNbTactics() const noexcept = 0;
1364 virtual
bool setL2LimitForTiling(int64_t size) noexcept = 0;
1365 virtual int64_t getL2LimitForTiling() const noexcept = 0;
1366 virtual
bool setRemoteAutoTuningConfig(
char const* config) noexcept = 0;
1367 virtual
char const* getRemoteAutoTuningConfig() const noexcept = 0;
1368 virtual
bool setBuildRoute(
char const* buildRoute) noexcept = 0;
1369 virtual
char const* getBuildRoute() const noexcept = 0;
1370 virtual
char const* getAllBuildRoutes() const noexcept = 0;
1373class VSerializationConfig : public VRoot
1383class VBuilder : public VRoot
1386 virtual int32_t getMaxDLABatchSize() const noexcept = 0;
1387 virtual int32_t getNbDLACores() const noexcept = 0;
1388 virtual
void setGpuAllocator(
IGpuAllocator* allocator) noexcept = 0;
1389 virtual
nvinfer1::IBuilderConfig* createBuilderConfig() noexcept = 0;
1391 virtual
nvinfer1::IOptimizationProfile* createOptimizationProfile() noexcept = 0;
1392 virtual
void setErrorRecorder(
IErrorRecorder* recorder) noexcept = 0;
1394 virtual
void reset() noexcept = 0;
1395 virtual
nvinfer1::IHostMemory* buildSerializedNetwork(
1396 INetworkDefinition& network, IBuilderConfig& config) noexcept = 0;
1397 virtual
bool isNetworkSupported(INetworkDefinition const& network, IBuilderConfig const& config) const noexcept = 0;
1399 virtual
bool setMaxThreads(int32_t maxThreads) noexcept = 0;
1400 virtual int32_t getMaxThreads() const noexcept = 0;
1402 virtual ICudaEngine* buildEngineWithConfig(INetworkDefinition& network, IBuilderConfig& config) noexcept = 0;
1403 virtual
bool buildSerializedNetworkToStream(
1404 INetworkDefinition& network, IBuilderConfig& config,
IStreamWriter& writer) noexcept = 0;
1405 virtual
nvinfer1::IHostMemory* buildSerializedNetworkWithKernelText(
1406 INetworkDefinition& network, IBuilderConfig& config, IHostMemory*& kernelText) noexcept
1420 INetworkDefinition& network, IBuilderConfig& config,
bool emitCheckerBlob) noexcept
1424class VRuntimeConfig : public VRoot
1427 virtual IRuntimeConfig* getPImpl() noexcept = 0;
1433class VDistCollectiveLayer : public VRoot
TENSORRTAPI nvinfer1::IPluginRegistry * getPluginRegistry() noexcept
Return the plugin registry.
TENSORRTAPI nvinfer1::ILogger * getLogger() noexcept
Return the logger object.
#define TRT_NODISCARD
A stand-in for [[nodiscard]] and [[nodiscard(REASON)]] that works with older compilers.
Definition: NvInferRuntimeBase.h:65
#define TRT_DEPRECATED
Definition: NvInferRuntimeBase.h:50
Structure to define the dimensions of a tensor.
User-implemented callback for notification when value of a debug tensor is updated.
Reference counted application-implemented error reporting interface for TensorRT objects.
Application-implemented class for controlling allocation on the GPU.
Callback from ExecutionContext::enqueueV3()
Application-implemented interface for profiling.
Application-implemented progress reporting interface for TensorRT.
Application-implemented class for reading data in a stream-based manner.
Application-implemented class for reading data in a stream-based manner asynchronously....
Application-implemented class for writing data in a stream-based manner.
Class to handle library allocated memory that is accessible to the user.
Definition: NvInferRuntime.h:150
The TensorRT API version 1 namespace.
Definition: NvInferSafePlugin.h:33
uint32_t TacticSources
Represents a collection of one or more TacticSource values combine using bitwise-OR operations.
Definition: NvInferRuntime.h:2910
v_1_0::IOutputAllocator IOutputAllocator
Definition: NvInferRuntime.h:4036
ResizeSelector
The coordinate selector when resize to single pixel output.
Definition: NvInfer.h:3979
EngineCapability
List of supported engine capability flows.
Definition: NvInferRuntime.h:76
DimensionOperation
An operation on two IDimensionExpr, which represent integer expressions used in dimension computation...
Definition: NvInferRuntime.h:189
MemoryPoolType
The type for memory pools used by TensorRT.
Definition: NvInfer.h:10347
AttentionIOForm
Enumerates the layout of the input/output tensors in an Attention layer.
Definition: NvInfer.h:6796
ScaleMode
Controls how shift, scale and power are applied in a Scale layer.
Definition: NvInfer.h:1649
RuntimePlatform
Describes the intended runtime platform (operating system and CPU architecture) for the execution of ...
Definition: NvInfer.h:9960
TensorIOMode
Definition of tensor IO Mode.
Definition: NvInferRuntimeBase.h:677
HardwareCompatibilityLevel
Describes requirements of compatibility with GPU architectures other than that of the GPU on which th...
Definition: NvInfer.h:10460
CumulativeOperation
Enumerates the cumulative operations that may be performed by a Cumulative layer.
Definition: NvInfer.h:6604
SerializationFlag
List of valid flags that the engine can enable when serializing the bytes.
Definition: NvInferRuntime.h:2951
BoundingBoxFormat
Representation of bounding box data used for the Boxes input tensor in INMSLayer.
Definition: NvInfer.h:6165
v_1_0::IPluginV3 IPluginV3
Definition: NvInferPluginBase.h:279
UnaryOperation
Enumerates the unary operations that may be performed by a Unary layer.
Definition: NvInfer.h:2607
DLAWorkspaceAllocationStrategy
Describes how DLA workspace memory is allocated.
Definition: NvInferRuntime.h:1576
v_1_0::IStreamWriter IStreamWriter
Definition: NvInferRuntime.h:710
v_1_0::IProfiler IProfiler
Definition: NvInferRuntime.h:1320
v_1_0::IStreamReaderV2 IStreamReaderV2
Definition: NvInferRuntime.h:787
ActivationType
Enumerates the types of activation to perform in an activation layer.
Definition: NvInfer.h:143
uint32_t TempfileControlFlags
Represents a collection of one or more TempfileControlFlag values combined using bitwise-OR operation...
Definition: NvInferRuntime.h:1398
FillOperation
Enumerates the tensor fill operations that may performed by a fill layer.
Definition: NvInfer.h:4982
EngineStat
The kind of engine statistics that queried from the ICudaEngine.
Definition: NvInferRuntime.h:3121
ResizeRoundMode
The rounding mode for nearest neighbor resize.
Definition: NvInfer.h:4006
v_1_0::ILogger ILogger
Definition: NvInferRuntimeBase.h:135
CausalMaskKind
Enumerates the causal mask alignment orientation for the attention.
Definition: NvInfer.h:6768
PaddingMode
Enumerates the modes of padding to perform in convolution, deconvolution and pooling layer,...
Definition: NvInfer.h:826
TripLimit
Enum that describes kinds of trip limits.
Definition: NvInfer.h:4364
uint32_t NetworkDefinitionCreationFlags
Represents one or more NetworkDefinitionCreationFlag flags using binary OR operations....
Definition: NvInfer.h:11546
PreviewFeature
Define preview features.
Definition: NvInfer.h:10426
TilingOptimizationLevel
Define the optimization levels for Tiling.
Definition: NvInfer.h:10513
DataType
The type of weights and tensors. The datatypes other than kBOOL, kINT32, and kINT64 are "activation d...
Definition: NvInferRuntimeBase.h:161
uint32_t BuilderFlags
Represents one or more BuilderFlag values using binary OR operations, e.g., 1U << BuilderFlag::kDEBUG...
Definition: NvInfer.h:9990
DeviceType
The device that this layer/network will execute on.
Definition: NvInferRuntime.h:1352
LayerType
The type values of layer classes.
Definition: NvInfer.h:58
SampleMode
Controls how ISliceLayer and IGridSample handle out-of-bounds coordinates.
Definition: NvInfer.h:3109
GatherMode
Control form of IGatherLayer.
Definition: NvInfer.h:2348
v_1_0::IDebugListener IDebugListener
Definition: NvInferRuntime.h:4077
MoEActType
Enumerates the activation type for the MoE layer.
Definition: NvInfer.h:7685
WeightsRole
How a layer uses particular Weights.
Definition: NvInferRuntime.h:1330
uint32_t TensorFormats
It is capable of representing one or more TensorFormat by binary OR operations, e....
Definition: NvInfer.h:135
ProfilingVerbosity
List of verbosity levels of layer information exposed in NVTX annotations and in IEngineInspector.
Definition: NvInferRuntime.h:2922
NetworkDefinitionCreationFlag
List of immutable network properties expressed at network creation time. NetworkDefinitionCreationFla...
Definition: NvInfer.h:11557
ElementWiseOperation
Enumerates the binary operations that may be performed by an ElementWise layer.
Definition: NvInfer.h:2259
CollectiveOperation
Enumerates the collective operations that may be performed by a DistCollective layer.
Definition: NvInfer.h:2737
uint32_t SerializationFlags
Represents one or more SerializationFlag values using binary OR operations, e.g., 1U << Serialization...
Definition: NvInferRuntime.h:2941
InterpolationMode
Enumerates various modes of interpolation.
Definition: NvInfer.h:3903
BuilderFlag
List of valid modes that the builder can enable when creating an engine from a network definition.
Definition: NvInfer.h:10000
TensorFormat
Format of the input/output tensors.
Definition: NvInferRuntime.h:1432
ExecutionContextAllocationStrategy
Different memory allocation behaviors for IExecutionContext.
Definition: NvInferRuntime.h:3058
TopKOperation
Enumerates the operations that may be performed by a TopK layer.
Definition: NvInfer.h:3394
ReduceOperation
Enumerates the reduce operations that may be performed by a Reduce layer.
Definition: NvInfer.h:2709
LayerInformationFormat
The format in which the IEngineInspector prints the layer information.
Definition: NvInferRuntime.h:5041
ScatterMode
Control form of IScatterLayer.
Definition: NvInfer.h:5892
MatrixOperation
Enumerates the operations that may be performed on a tensor by IMatrixMultiplyLayer before multiplica...
Definition: NvInfer.h:3549
ResizeCoordinateTransformation
The resize coordinate transformation function.
Definition: NvInfer.h:3928
LoopOutput
Enum that describes kinds of loop outputs.
Definition: NvInfer.h:4336
KVCacheMode
Enumerates the KVCache modes that may be performed by a KVCacheUpdate layer.
Definition: NvInfer.h:7532
v_1_0::IStreamReader IStreamReader
Definition: NvInferRuntime.h:700
PoolingType
The type of pooling to perform in a pooling layer.
Definition: NvInfer.h:1263
v_1_0::IProgressMonitor IProgressMonitor
Definition: NvInfer.h:10626
TensorLocation
The location for tensor data storage, device or host.
Definition: NvInferRuntime.h:214
OptProfileSelector
When setting or querying optimization profile parameters (such as shape tensor inputs or dynamic dime...
Definition: NvInferRuntime.h:2631
AttentionNormalizationOp
Enumerates the operations that may be performed by the normalization in the attention subgraph.
Definition: NvInfer.h:6736