TensorRT  7.0.0.11
NvInfer.h
Go to the documentation of this file.
1 /*
2  * Copyright 1993-2019 NVIDIA Corporation. All rights reserved.
3  *
4  * NOTICE TO LICENSEE:
5  *
6  * This source code and/or documentation ("Licensed Deliverables") are
7  * subject to NVIDIA intellectual property rights under U.S. and
8  * international Copyright laws.
9  *
10  * These Licensed Deliverables contained herein is PROPRIETARY and
11  * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12  * conditions of a form of NVIDIA software license agreement by and
13  * between NVIDIA and Licensee ("License Agreement") or electronically
14  * accepted by Licensee. Notwithstanding any terms or conditions to
15  * the contrary in the License Agreement, reproduction or disclosure
16  * of the Licensed Deliverables to any third party without the express
17  * written consent of NVIDIA is prohibited.
18  *
19  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20  * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21  * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22  * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23  * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24  * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25  * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27  * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28  * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32  * OF THESE LICENSED DELIVERABLES.
33  *
34  * U.S. Government End Users. These Licensed Deliverables are a
35  * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36  * 1995), consisting of "commercial computer software" and "commercial
37  * computer software documentation" as such terms are used in 48
38  * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39  * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40  * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41  * U.S. Government End Users acquire the Licensed Deliverables with
42  * only those rights set forth herein.
43  *
44  * Any use of the Licensed Deliverables in individual and commercial
45  * software must include, in the user documentation and internal
46  * comments to the code, the above Disclaimer and U.S. Government End
47  * Users Notice.
48  */
49 
50 #ifndef NV_INFER_H
51 #define NV_INFER_H
52 
53 #include "NvInferRuntime.h"
54 
63 //
66 
72 
78 namespace nvinfer1
79 {
80 
85 class Dims2 : public Dims
86 {
87 public:
92  {
93  nbDims = 2;
94  d[0] = d[1] = 0;
95  }
96 
103  Dims2(int d0, int d1)
104  {
105  nbDims = 2;
106  d[0] = d0;
107  d[1] = d1;
108  }
109 };
110 
115 class DimsHW : public Dims2
116 {
117 public:
122  : Dims2()
123  {
125  }
126 
133  DimsHW(int height, int width)
134  : Dims2(height, width)
135  {
137  }
138 
144  int& h() { return d[0]; }
145 
151  int h() const { return d[0]; }
152 
158  int& w() { return d[1]; }
159 
165  int w() const { return d[1]; }
166 };
167 
172 class Dims3 : public Dims
173 {
174 public:
179  {
180  nbDims = 3;
181  d[0] = d[1] = d[2] = 0;
182  }
183 
191  Dims3(int d0, int d1, int d2)
192  {
193  nbDims = 3;
194  d[0] = d0;
195  d[1] = d1;
196  d[2] = d2;
197  }
198 };
199 
206 class TRT_DEPRECATED DimsCHW : public Dims3
207 {
208 public:
213  : Dims3()
214  {
217  }
218 
226  DimsCHW(int channels, int height, int width)
227  : Dims3(channels, height, width)
228  {
231  }
232 
238  int& c() { return d[0]; }
239 
245  int c() const { return d[0]; }
246 
252  int& h() { return d[1]; }
253 
259  int h() const { return d[1]; }
260 
266  int& w() { return d[2]; }
267 
273  int w() const { return d[2]; }
274 };
275 
280 class Dims4 : public Dims
281 {
282 public:
287  {
288  nbDims = 4;
289  d[0] = d[1] = d[2] = d[3] = 0;
290  }
291 
300  Dims4(int d0, int d1, int d2, int d3)
301  {
302  nbDims = 4;
303  d[0] = d0;
304  d[1] = d1;
305  d[2] = d2;
306  d[3] = d3;
307  }
308 };
309 
316 class TRT_DEPRECATED DimsNCHW : public Dims4
317 {
318 public:
323  : Dims4()
324  {
328  }
329 
338  DimsNCHW(int batchSize, int channels, int height, int width)
339  : Dims4(batchSize, channels, height, width)
340  {
344  }
345 
351  int& n() { return d[0]; }
352 
358  int n() const { return d[0]; }
359 
365  int& c() { return d[1]; }
366 
372  int c() const { return d[1]; }
373 
379  int& h() { return d[2]; }
380 
386  int h() const { return d[2]; }
387 
393  int& w() { return d[3]; }
394 
400  int w() const { return d[3]; }
401 };
402 
410 enum class LayerType : int
411 {
412  kCONVOLUTION = 0,
413  kFULLY_CONNECTED = 1,
414  kACTIVATION = 2,
415  kPOOLING = 3,
416  kLRN = 4,
417  kSCALE = 5,
418  kSOFTMAX = 6,
419  kDECONVOLUTION = 7,
420  kCONCATENATION = 8,
421  kELEMENTWISE = 9,
422  kPLUGIN = 10,
423  kRNN = 11,
424  kUNARY = 12,
425  kPADDING = 13,
426  kSHUFFLE = 14,
427  kREDUCE = 15,
428  kTOPK = 16,
429  kGATHER = 17,
430  kMATRIX_MULTIPLY = 18,
431  kRAGGED_SOFTMAX = 19,
432  kCONSTANT = 20,
433  kRNN_V2 = 21,
434  kIDENTITY = 22,
435  kPLUGIN_V2 = 23,
436  kSLICE = 24,
437  kSHAPE = 25,
438  kPARAMETRIC_RELU = 26,
439  kRESIZE = 27,
440  kTRIP_LIMIT = 28,
441  kRECURRENCE = 29,
442  kITERATOR = 30,
443  kLOOP_OUTPUT = 31,
444  kSELECT = 32,
445  kFILL = 33
446 };
447 
448 template <>
449 constexpr inline int EnumMax<LayerType>()
450 {
451  return 34;
452 }
453 
463 class ITensor
464 {
465 public:
478  virtual void setName(const char* name) TRTNOEXCEPT = 0;
479 
487  virtual const char* getName() const TRTNOEXCEPT = 0;
488 
503  virtual void setDimensions(Dims dimensions) TRTNOEXCEPT = 0; // only valid for input tensors
504 
513  virtual Dims getDimensions() const TRTNOEXCEPT = 0;
514 
525  virtual void setType(DataType type) TRTNOEXCEPT = 0;
526 
534  virtual DataType getType() const TRTNOEXCEPT = 0;
535 
546  virtual bool setDynamicRange(float min, float max) TRTNOEXCEPT = 0;
547 
555  TRT_DEPRECATED virtual float getDynamicRange() const TRTNOEXCEPT = 0;
556 
560  virtual bool isNetworkInput() const TRTNOEXCEPT = 0;
561 
565  virtual bool isNetworkOutput() const TRTNOEXCEPT = 0;
566 
567 protected:
568  virtual ~ITensor() {}
569 
570 public:
588  virtual void setBroadcastAcrossBatch(bool broadcastAcrossBatch) TRTNOEXCEPT = 0;
589 
601  virtual bool getBroadcastAcrossBatch() const TRTNOEXCEPT = 0;
602 
608  virtual TensorLocation getLocation() const TRTNOEXCEPT = 0;
609 
620  virtual void setLocation(TensorLocation location) TRTNOEXCEPT = 0;
621 
627  virtual bool dynamicRangeIsSet() const TRTNOEXCEPT = 0;
628 
632  virtual void resetDynamicRange() TRTNOEXCEPT = 0;
633 
639  virtual float getDynamicRangeMin() const TRTNOEXCEPT = 0;
640 
646  virtual float getDynamicRangeMax() const TRTNOEXCEPT = 0;
647 
656  virtual void setAllowedFormats(TensorFormats formats) TRTNOEXCEPT = 0;
657 
666  virtual TensorFormats getAllowedFormats() const TRTNOEXCEPT = 0;
667 
678  virtual bool isShapeTensor() const TRTNOEXCEPT = 0;
679 
694  virtual bool isExecutionTensor() const TRTNOEXCEPT = 0;
695 };
696 
704 class ILayer
705 {
706 public:
712  virtual LayerType getType() const TRTNOEXCEPT = 0;
713 
721  virtual void setName(const char* name) TRTNOEXCEPT = 0;
722 
726 
729  virtual const char* getName() const TRTNOEXCEPT = 0;
730 
734  virtual int getNbInputs() const TRTNOEXCEPT = 0;
735 
744  virtual ITensor* getInput(int index) const TRTNOEXCEPT = 0;
745 
749  virtual int getNbOutputs() const TRTNOEXCEPT = 0;
750 
757  virtual ITensor* getOutput(int index) const TRTNOEXCEPT = 0;
758 
764  //
773  virtual void setInput(int index, ITensor& tensor) TRTNOEXCEPT = 0;
774 
789 
790  virtual void setPrecision(DataType dataType) TRTNOEXCEPT = 0;
791 
798 
799  virtual DataType getPrecision() const TRTNOEXCEPT = 0;
800 
807 
808  virtual bool precisionIsSet() const TRTNOEXCEPT = 0;
809 
814 
815  virtual void resetPrecision() TRTNOEXCEPT = 0;
816 
841 
842  virtual void setOutputType(int index, DataType dataType) TRTNOEXCEPT = 0;
843 
852 
853  virtual DataType getOutputType(int index) const TRTNOEXCEPT = 0;
854 
862 
863  virtual bool outputTypeIsSet(int index) const TRTNOEXCEPT = 0;
864 
871 
872  virtual void resetOutputType(int index) TRTNOEXCEPT = 0;
873 
874 protected:
875  virtual ~ILayer() {}
876 };
877 
1100 enum class PaddingMode : int
1101 {
1102  kEXPLICIT_ROUND_DOWN = 0,
1103  kEXPLICIT_ROUND_UP = 1,
1104  kSAME_UPPER = 2,
1105  kSAME_LOWER = 3,
1106  kCAFFE_ROUND_DOWN = 4,
1107  kCAFFE_ROUND_UP = 5
1108 };
1109 
1110 template <>
1111 constexpr inline int EnumMax<PaddingMode>()
1112 {
1113  return 6;
1114 }
1115 
1129 {
1130 public:
1140  TRT_DEPRECATED virtual void setKernelSize(DimsHW kernelSize) TRTNOEXCEPT = 0;
1141 
1149  TRT_DEPRECATED virtual DimsHW getKernelSize() const TRTNOEXCEPT = 0;
1150 
1158  virtual void setNbOutputMaps(int nbOutputMaps) TRTNOEXCEPT = 0;
1159 
1165  virtual int getNbOutputMaps() const TRTNOEXCEPT = 0;
1166 
1178  TRT_DEPRECATED virtual void setStride(DimsHW stride) TRTNOEXCEPT = 0;
1179 
1185  TRT_DEPRECATED virtual DimsHW getStride() const TRTNOEXCEPT = 0;
1186 
1201  TRT_DEPRECATED virtual void setPadding(DimsHW padding) TRTNOEXCEPT = 0;
1202 
1210  TRT_DEPRECATED virtual DimsHW getPadding() const TRTNOEXCEPT = 0;
1211 
1225  virtual void setNbGroups(int nbGroups) TRTNOEXCEPT = 0;
1226 
1232  virtual int getNbGroups() const TRTNOEXCEPT = 0;
1233 
1243  virtual void setKernelWeights(Weights weights) TRTNOEXCEPT = 0;
1244 
1250  virtual Weights getKernelWeights() const TRTNOEXCEPT = 0;
1251 
1262  virtual void setBiasWeights(Weights weights) TRTNOEXCEPT = 0;
1263 
1269  virtual Weights getBiasWeights() const TRTNOEXCEPT = 0;
1270 
1280  TRT_DEPRECATED virtual void setDilation(DimsHW dilation) TRTNOEXCEPT = 0;
1281 
1289  TRT_DEPRECATED virtual DimsHW getDilation() const TRTNOEXCEPT = 0;
1290 
1291 protected:
1292  virtual ~IConvolutionLayer() {}
1293 
1294 public:
1306  virtual void setPrePadding(Dims padding) TRTNOEXCEPT = 0;
1307 
1313  virtual Dims getPrePadding() const TRTNOEXCEPT = 0;
1314 
1326  virtual void setPostPadding(Dims padding) TRTNOEXCEPT = 0;
1327 
1333  virtual Dims getPostPadding() const TRTNOEXCEPT = 0;
1334 
1344  virtual void setPaddingMode(PaddingMode paddingMode) TRTNOEXCEPT = 0;
1345 
1353  virtual PaddingMode getPaddingMode() const TRTNOEXCEPT = 0;
1354 
1362  virtual void setKernelSizeNd(Dims kernelSize) TRTNOEXCEPT = 0;
1363 
1369  virtual Dims getKernelSizeNd() const TRTNOEXCEPT = 0;
1370 
1380  virtual void setStrideNd(Dims stride) TRTNOEXCEPT = 0;
1381 
1387  virtual Dims getStrideNd() const TRTNOEXCEPT = 0;
1388 
1401  virtual void setPaddingNd(Dims padding) TRTNOEXCEPT = 0;
1402 
1410  virtual Dims getPaddingNd() const TRTNOEXCEPT = 0;
1411 
1419  virtual void setDilationNd(Dims dilation) TRTNOEXCEPT = 0;
1420 
1426  virtual Dims getDilationNd() const TRTNOEXCEPT = 0;
1427 
1444  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
1445 };
1446 
1477 {
1478 public:
1486  virtual void setNbOutputChannels(int nbOutputs) TRTNOEXCEPT = 0;
1487 
1493  virtual int getNbOutputChannels() const TRTNOEXCEPT = 0;
1494 
1500  virtual void setKernelWeights(Weights weights) TRTNOEXCEPT = 0;
1501 
1507  virtual Weights getKernelWeights() const TRTNOEXCEPT = 0;
1508 
1516  virtual void setBiasWeights(Weights weights) TRTNOEXCEPT = 0;
1517 
1523  virtual Weights getBiasWeights() const TRTNOEXCEPT = 0;
1524 
1525 protected:
1526  virtual ~IFullyConnectedLayer() {}
1527 
1528 public:
1545  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
1546 };
1547 
1559 class IActivationLayer : public ILayer
1560 {
1561 public:
1567  virtual void setActivationType(ActivationType type) TRTNOEXCEPT = 0;
1568 
1574  virtual ActivationType getActivationType() const TRTNOEXCEPT = 0;
1575 
1576 protected:
1577  virtual ~IActivationLayer() {}
1578 public:
1589  virtual void setAlpha(float alpha) TRTNOEXCEPT = 0;
1590 
1600  virtual void setBeta(float beta) TRTNOEXCEPT = 0;
1601 
1606  virtual float getAlpha() const TRTNOEXCEPT = 0;
1607 
1612  virtual float getBeta() const TRTNOEXCEPT = 0;
1613 };
1614 
1620 enum class PoolingType : int
1621 {
1622  kMAX = 0, // Maximum over elements
1623  kAVERAGE = 1, // Average over elements. If the tensor is padded, the count includes the padding
1624  kMAX_AVERAGE_BLEND = 2 // Blending between max and average pooling: (1-blendFactor)*maxPool + blendFactor*avgPool
1625 };
1626 
1627 template <>
1628 constexpr inline int EnumMax<PoolingType>()
1629 {
1630  return 3;
1631 }
1632 
1641 class IPoolingLayer : public ILayer
1642 {
1643 public:
1651  virtual void setPoolingType(PoolingType type) TRTNOEXCEPT = 0;
1652 
1658  virtual PoolingType getPoolingType() const TRTNOEXCEPT = 0;
1659 
1669  TRT_DEPRECATED virtual void setWindowSize(DimsHW windowSize) TRTNOEXCEPT = 0;
1670 
1678  TRT_DEPRECATED virtual DimsHW getWindowSize() const TRTNOEXCEPT = 0;
1679 
1691  TRT_DEPRECATED virtual void setStride(DimsHW stride) TRTNOEXCEPT = 0;
1692 
1700  TRT_DEPRECATED virtual DimsHW getStride() const TRTNOEXCEPT = 0;
1701 
1713  TRT_DEPRECATED virtual void setPadding(DimsHW padding) TRTNOEXCEPT = 0;
1714 
1724  TRT_DEPRECATED virtual DimsHW getPadding() const TRTNOEXCEPT = 0;
1725 
1734  virtual void setBlendFactor(float blendFactor) TRTNOEXCEPT = 0;
1735 
1744  virtual float getBlendFactor() const TRTNOEXCEPT = 0;
1745 
1755  virtual void setAverageCountExcludesPadding(bool exclusive) TRTNOEXCEPT = 0;
1756 
1763  virtual bool getAverageCountExcludesPadding() const TRTNOEXCEPT = 0;
1764 
1765 protected:
1766  virtual ~IPoolingLayer() {}
1767 
1768 public:
1780  virtual void setPrePadding(Dims padding) TRTNOEXCEPT = 0;
1781 
1787  virtual Dims getPrePadding() const TRTNOEXCEPT = 0;
1788 
1800  virtual void setPostPadding(Dims padding) TRTNOEXCEPT = 0;
1801 
1807  virtual Dims getPostPadding() const TRTNOEXCEPT = 0;
1808 
1817  virtual void setPaddingMode(PaddingMode paddingMode) TRTNOEXCEPT = 0;
1818 
1825  virtual PaddingMode getPaddingMode() const TRTNOEXCEPT = 0;
1826 
1834  virtual void setWindowSizeNd(Dims windowSize) TRTNOEXCEPT = 0;
1835 
1841  virtual Dims getWindowSizeNd() const TRTNOEXCEPT = 0;
1842 
1852  virtual void setStrideNd(Dims stride) TRTNOEXCEPT = 0;
1853 
1859  virtual Dims getStrideNd() const TRTNOEXCEPT = 0;
1860 
1873  virtual void setPaddingNd(Dims padding) TRTNOEXCEPT = 0;
1874 
1882  virtual Dims getPaddingNd() const TRTNOEXCEPT = 0;
1883 };
1884 
1894 class ILRNLayer : public ILayer
1895 {
1896 public:
1903  virtual void setWindowSize(int windowSize) TRTNOEXCEPT = 0;
1904 
1910  virtual int getWindowSize() const TRTNOEXCEPT = 0;
1911 
1918  virtual void setAlpha(float alpha) TRTNOEXCEPT = 0;
1919 
1925  virtual float getAlpha() const TRTNOEXCEPT = 0;
1926 
1933  virtual void setBeta(float beta) TRTNOEXCEPT = 0;
1934 
1940  virtual float getBeta() const TRTNOEXCEPT = 0;
1941 
1948  virtual void setK(float k) TRTNOEXCEPT = 0;
1949 
1955  virtual float getK() const TRTNOEXCEPT = 0;
1956 
1957 protected:
1958  virtual ~ILRNLayer() {}
1959 };
1960 
1966 enum class ScaleMode : int
1967 {
1968  kUNIFORM = 0,
1969  kCHANNEL = 1,
1970  kELEMENTWISE = 2
1971 };
1972 
1973 template <>
1974 constexpr inline int EnumMax<ScaleMode>()
1975 {
1976  return 3;
1977 }
1978 
2001 class IScaleLayer : public ILayer
2002 {
2003 public:
2009  virtual void setMode(ScaleMode mode) TRTNOEXCEPT = 0;
2010 
2016  virtual ScaleMode getMode() const TRTNOEXCEPT = 0;
2017 
2023  virtual void setShift(Weights shift) TRTNOEXCEPT = 0;
2024 
2030  virtual Weights getShift() const TRTNOEXCEPT = 0;
2031 
2037  virtual void setScale(Weights scale) TRTNOEXCEPT = 0;
2038 
2044  virtual Weights getScale() const TRTNOEXCEPT = 0;
2045 
2051  virtual void setPower(Weights power) TRTNOEXCEPT = 0;
2052 
2058  virtual Weights getPower() const TRTNOEXCEPT = 0;
2059 
2060 protected:
2061  virtual ~IScaleLayer() {}
2062 
2063 public:
2076  virtual int getChannelAxis() const TRTNOEXCEPT = 0;
2077 };
2078 
2090 class ISoftMaxLayer : public ILayer
2091 {
2092 protected:
2093  virtual ~ISoftMaxLayer() {}
2094 public:
2124  virtual void setAxes(uint32_t axes) TRTNOEXCEPT = 0;
2125 
2131  virtual uint32_t getAxes() const TRTNOEXCEPT = 0;
2132 };
2133 
2146 {
2147 protected:
2148  virtual ~IConcatenationLayer() {}
2149 
2150 public:
2159  virtual void setAxis(int axis) TRTNOEXCEPT = 0;
2160 
2166  virtual int getAxis() const TRTNOEXCEPT = 0;
2167 };
2168 
2179 {
2180 public:
2190  TRT_DEPRECATED virtual void setKernelSize(DimsHW kernelSize) TRTNOEXCEPT = 0;
2191 
2199  TRT_DEPRECATED virtual DimsHW getKernelSize() const TRTNOEXCEPT = 0;
2200 
2208  virtual void setNbOutputMaps(int nbOutputMaps) TRTNOEXCEPT = 0;
2209 
2215  virtual int getNbOutputMaps() const TRTNOEXCEPT = 0;
2216 
2226  TRT_DEPRECATED virtual void setStride(DimsHW stride) TRTNOEXCEPT = 0;
2227 
2235  TRT_DEPRECATED virtual DimsHW getStride() const TRTNOEXCEPT = 0;
2236 
2252  TRT_DEPRECATED virtual void setPadding(DimsHW padding) TRTNOEXCEPT = 0;
2253 
2263  TRT_DEPRECATED virtual DimsHW getPadding() const TRTNOEXCEPT = 0;
2264 
2278  virtual void setNbGroups(int nbGroups) TRTNOEXCEPT = 0;
2279 
2285  virtual int getNbGroups() const TRTNOEXCEPT = 0;
2286 
2296  virtual void setKernelWeights(Weights weights) TRTNOEXCEPT = 0;
2297 
2303  virtual Weights getKernelWeights() const TRTNOEXCEPT = 0;
2304 
2315  virtual void setBiasWeights(Weights weights) TRTNOEXCEPT = 0;
2316 
2322  virtual Weights getBiasWeights() const TRTNOEXCEPT = 0;
2323 
2324 protected:
2325  virtual ~IDeconvolutionLayer() {}
2326 
2327 public:
2339  virtual void setPrePadding(Dims padding) TRTNOEXCEPT = 0;
2340 
2346  virtual Dims getPrePadding() const TRTNOEXCEPT = 0;
2347 
2359  virtual void setPostPadding(Dims padding) TRTNOEXCEPT = 0;
2360 
2366  virtual Dims getPostPadding() const TRTNOEXCEPT = 0;
2367 
2377  virtual void setPaddingMode(PaddingMode paddingMode) TRTNOEXCEPT = 0;
2378 
2386  virtual PaddingMode getPaddingMode() const TRTNOEXCEPT = 0;
2387 
2395  virtual void setKernelSizeNd(Dims kernelSize) TRTNOEXCEPT = 0;
2396 
2402  virtual Dims getKernelSizeNd() const TRTNOEXCEPT = 0;
2403 
2413  virtual void setStrideNd(Dims stride) TRTNOEXCEPT = 0;
2414 
2420  virtual Dims getStrideNd() const TRTNOEXCEPT = 0;
2421 
2434  virtual void setPaddingNd(Dims padding) TRTNOEXCEPT = 0;
2435 
2443  virtual Dims getPaddingNd() const TRTNOEXCEPT = 0;
2444 
2462  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
2463 };
2464 
2472 enum class ElementWiseOperation : int
2473 {
2474  kSUM = 0,
2475  kPROD = 1,
2476  kMAX = 2,
2477  kMIN = 3,
2478  kSUB = 4,
2479  kDIV = 5,
2480  kPOW = 6,
2481  kFLOOR_DIV = 7,
2482  kAND = 8,
2483  kOR = 9,
2484  kXOR = 10,
2485  kEQUAL = 11,
2486  kGREATER = 12,
2487  kLESS = 13
2488 };
2489 
2490 template <>
2491 constexpr inline int EnumMax<ElementWiseOperation>()
2492 {
2493  return 14;
2494 }
2495 
2508 {
2509 public:
2519  virtual void setOperation(ElementWiseOperation op) TRTNOEXCEPT = 0;
2520 
2528  virtual ElementWiseOperation getOperation() const TRTNOEXCEPT = 0;
2529 
2530 protected:
2531  virtual ~IElementWiseLayer() {}
2532 };
2533 
2537 class IGatherLayer : public ILayer
2538 {
2539 public:
2546  virtual void setGatherAxis(int axis) TRTNOEXCEPT = 0;
2547 
2553  virtual int getGatherAxis() const TRTNOEXCEPT = 0;
2554 
2561  virtual void setNbElementWiseDims(int k) TRTNOEXCEPT = 0;
2562 
2568  virtual int getNbElementWiseDims() const TRTNOEXCEPT = 0;
2569 
2570 protected:
2571  virtual ~IGatherLayer() {}
2572 };
2573 
2653 enum class RNNOperation : int
2654 {
2655  kRELU = 0,
2656  kTANH = 1,
2657  kLSTM = 2,
2658  kGRU = 3
2659 };
2660 
2661 template <>
2662 constexpr inline int EnumMax<RNNOperation>()
2663 {
2664  return 4;
2665 }
2666 
2674 enum class RNNDirection : int
2675 {
2676  kUNIDIRECTION = 0,
2677  kBIDIRECTION = 1
2678 };
2679 
2680 template <>
2681 constexpr inline int EnumMax<RNNDirection>()
2682 {
2683  return 2;
2684 }
2685 
2701 enum class RNNInputMode : int
2702 {
2703  kLINEAR = 0,
2704  kSKIP = 1
2705 };
2706 
2707 template <>
2708 constexpr inline int EnumMax<RNNInputMode>()
2709 {
2710  return 2;
2711 }
2712 
2726 class TRT_DEPRECATED IRNNLayer : public ILayer
2727 {
2728 public:
2734  virtual unsigned getLayerCount() const TRTNOEXCEPT = 0;
2735 
2744  virtual std::size_t getHiddenSize() const TRTNOEXCEPT = 0;
2745 
2754  virtual int getSeqLength() const TRTNOEXCEPT = 0;
2755 
2761  virtual void setOperation(RNNOperation op) TRTNOEXCEPT = 0;
2762 
2768  virtual RNNOperation getOperation() const TRTNOEXCEPT = 0;
2769 
2775  virtual void setInputMode(RNNInputMode op) TRTNOEXCEPT = 0;
2776 
2782  virtual RNNInputMode getInputMode() const TRTNOEXCEPT = 0;
2783 
2795  virtual void setDirection(RNNDirection op) TRTNOEXCEPT = 0;
2796 
2802  virtual RNNDirection getDirection() const TRTNOEXCEPT = 0;
2803 
2918  virtual void setWeights(Weights weights) TRTNOEXCEPT = 0;
2919 
2925  virtual Weights getWeights() const TRTNOEXCEPT = 0;
2926 
2978  virtual void setBias(Weights bias) TRTNOEXCEPT = 0;
2979 
2985  virtual Weights getBias() const TRTNOEXCEPT = 0;
2986 
2993  virtual int getDataLength() const TRTNOEXCEPT = 0;
2994 
3012  virtual void setHiddenState(ITensor& hidden) TRTNOEXCEPT = 0;
3013 
3019  virtual ITensor* getHiddenState() const TRTNOEXCEPT = 0;
3020 
3040  virtual void setCellState(ITensor& cell) TRTNOEXCEPT = 0;
3041 
3047  virtual ITensor* getCellState() const TRTNOEXCEPT = 0;
3048 
3049 protected:
3050  virtual ~IRNNLayer() {}
3051 };
3052 
3060 enum class RNNGateType : int
3061 {
3062  kINPUT = 0,
3063  kOUTPUT = 1,
3064  kFORGET = 2,
3065  kUPDATE = 3,
3066  kRESET = 4,
3067  kCELL = 5,
3068  kHIDDEN = 6
3069 };
3070 
3071 template <>
3072 constexpr inline int EnumMax<RNNGateType>()
3073 {
3074  return 7;
3075 }
3076 
3086 class IRNNv2Layer : public ILayer
3087 {
3088 public:
3089  virtual int32_t getLayerCount() const TRTNOEXCEPT = 0; //< Get the layer count of the RNN
3090  virtual int32_t getHiddenSize() const TRTNOEXCEPT = 0; //< Get the hidden size of the RNN
3091  virtual int32_t getMaxSeqLength() const TRTNOEXCEPT = 0; //< Get the maximum sequence length of the RNN
3092  virtual int32_t getDataLength() const TRTNOEXCEPT = 0; //< Get the maximum data length of the RNN
3093 
3108  virtual void setSequenceLengths(ITensor& seqLengths) TRTNOEXCEPT = 0;
3109 
3117  virtual ITensor* getSequenceLengths() const TRTNOEXCEPT = 0;
3118 
3123  virtual void setOperation(RNNOperation op) TRTNOEXCEPT = 0;
3124 
3129  virtual RNNOperation getOperation() const TRTNOEXCEPT = 0;
3130 
3135  virtual void setInputMode(RNNInputMode op) TRTNOEXCEPT = 0;
3136 
3141  virtual RNNInputMode getInputMode() const TRTNOEXCEPT = 0;
3142 
3147  virtual void setDirection(RNNDirection op) TRTNOEXCEPT = 0;
3148 
3153  virtual RNNDirection getDirection() const TRTNOEXCEPT = 0;
3154 
3172  virtual void setWeightsForGate(int layerIndex, RNNGateType gate, bool isW, Weights weights) TRTNOEXCEPT = 0;
3173 
3178  virtual Weights getWeightsForGate(int layerIndex, RNNGateType gate, bool isW) const TRTNOEXCEPT = 0;
3179 
3195  virtual void setBiasForGate(int layerIndex, RNNGateType gate, bool isW, Weights bias) TRTNOEXCEPT = 0;
3196 
3201  virtual Weights getBiasForGate(int layerIndex, RNNGateType gate, bool isW) const TRTNOEXCEPT = 0;
3202 
3215  virtual void setHiddenState(ITensor& hidden) TRTNOEXCEPT = 0;
3216 
3221  virtual ITensor* getHiddenState() const TRTNOEXCEPT = 0;
3222 
3237  virtual void setCellState(ITensor& cell) TRTNOEXCEPT = 0;
3238 
3243  virtual ITensor* getCellState() const TRTNOEXCEPT = 0;
3244 
3245 protected:
3246  virtual ~IRNNv2Layer() {}
3247 };
3248 
3256 class TRT_DEPRECATED IOutputDimensionsFormula
3257 {
3258 public:
3274  virtual DimsHW compute(DimsHW inputDims, DimsHW kernelSize, DimsHW stride, DimsHW padding, DimsHW dilation, const char* layerName) const TRTNOEXCEPT = 0;
3275 
3276  virtual ~IOutputDimensionsFormula() {}
3277 };
3278 
3290 class TRT_DEPRECATED IPluginLayer : public ILayer
3291 {
3292 public:
3298  virtual IPlugin& getPlugin() TRTNOEXCEPT = 0;
3299 
3300 protected:
3301  virtual ~IPluginLayer() {}
3302 };
3303 
3313 class IPluginV2Layer : public ILayer
3314 {
3315 public:
3321  virtual IPluginV2& getPlugin() TRTNOEXCEPT = 0;
3322 
3323 protected:
3324  virtual ~IPluginV2Layer() {}
3325 };
3326 
3334 enum class UnaryOperation : int
3335 {
3336  kEXP = 0,
3337  kLOG = 1,
3338  kSQRT = 2,
3339  kRECIP = 3,
3340  kABS = 4,
3341  kNEG = 5,
3342  kSIN = 6,
3343  kCOS = 7,
3344  kTAN = 8,
3345  kSINH = 9,
3346  kCOSH = 10,
3347  kASIN = 11,
3348  kACOS = 12,
3349  kATAN = 13,
3350  kASINH = 14,
3351  kACOSH = 15,
3352  kATANH = 16,
3353  kCEIL = 17,
3354  kFLOOR = 18,
3355  kERF = 19,
3356  kNOT = 20
3357 };
3358 
3359 template <>
3360 constexpr inline int EnumMax<UnaryOperation>()
3361 {
3362  return 21;
3363 }
3364 
3372 class IUnaryLayer : public ILayer
3373 {
3374 public:
3380  virtual void setOperation(UnaryOperation op) TRTNOEXCEPT = 0;
3381 
3387  virtual UnaryOperation getOperation() const TRTNOEXCEPT = 0;
3388 
3389 protected:
3390  virtual ~IUnaryLayer() {}
3391 };
3392 
3398 enum class ReduceOperation : int
3399 {
3400  kSUM = 0,
3401  kPROD = 1,
3402  kMAX = 2,
3403  kMIN = 3,
3404  kAVG = 4
3405 };
3406 
3407 template <>
3408 constexpr inline int EnumMax<ReduceOperation>()
3409 {
3410  return 5;
3411 }
3412 
3420 class IReduceLayer : public ILayer
3421 {
3422 public:
3428  virtual void setOperation(ReduceOperation op) TRTNOEXCEPT = 0;
3429 
3435  virtual ReduceOperation getOperation() const TRTNOEXCEPT = 0;
3436 
3442  virtual void setReduceAxes(uint32_t reduceAxes) TRTNOEXCEPT = 0;
3443 
3449  virtual uint32_t getReduceAxes() const TRTNOEXCEPT = 0;
3450 
3456  virtual void setKeepDimensions(bool keepDimensions) TRTNOEXCEPT = 0;
3457 
3463  virtual bool getKeepDimensions() const TRTNOEXCEPT = 0;
3464 
3465 protected:
3466  virtual ~IReduceLayer() {}
3467 };
3468 
3479 class IPaddingLayer : public ILayer
3480 {
3481 public:
3491  TRT_DEPRECATED virtual void setPrePadding(DimsHW padding) TRTNOEXCEPT = 0;
3492 
3500  TRT_DEPRECATED virtual DimsHW getPrePadding() const TRTNOEXCEPT = 0;
3501 
3511  TRT_DEPRECATED virtual void setPostPadding(DimsHW padding) TRTNOEXCEPT = 0;
3512 
3520  TRT_DEPRECATED virtual DimsHW getPostPadding() const TRTNOEXCEPT = 0;
3521 
3522 protected:
3523  virtual ~IPaddingLayer() {}
3524 
3525 public:
3535  virtual void setPrePaddingNd(Dims padding) TRTNOEXCEPT = 0;
3536 
3544  virtual Dims getPrePaddingNd() const TRTNOEXCEPT = 0;
3545 
3555  virtual void setPostPaddingNd(Dims padding) TRTNOEXCEPT = 0;
3556 
3564  virtual Dims getPostPaddingNd() const TRTNOEXCEPT = 0;
3565 };
3566 
3568 {
3575  int order[Dims::MAX_DIMS];
3576 };
3577 
3590 class IShuffleLayer : public ILayer
3591 {
3592 public:
3602  virtual void setFirstTranspose(Permutation permutation) TRTNOEXCEPT = 0;
3603 
3611  virtual Permutation getFirstTranspose() const TRTNOEXCEPT = 0;
3612 
3633  virtual void setReshapeDimensions(Dims dimensions) TRTNOEXCEPT = 0;
3634 
3643  virtual Dims getReshapeDimensions() const TRTNOEXCEPT = 0;
3644 
3650  //
3665  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
3666 
3679  virtual void setSecondTranspose(Permutation permutation) TRTNOEXCEPT = 0;
3680 
3688  virtual Permutation getSecondTranspose() const TRTNOEXCEPT = 0;
3689 
3690 protected:
3691  virtual ~IShuffleLayer() {}
3692 };
3693 
3699 enum class SliceMode : int
3700 {
3701  kDEFAULT = 0,
3702  kWRAP = 1,
3703 };
3704 
3705 template <>
3706 constexpr inline int EnumMax<SliceMode>()
3707 {
3708  return 2;
3709 }
3710 
3739 class ISliceLayer : public ILayer
3740 {
3741 public:
3751  virtual void setStart(Dims start) TRTNOEXCEPT = 0;
3752 
3763  virtual Dims getStart() const TRTNOEXCEPT = 0;
3764 
3774  virtual void setSize(Dims size) TRTNOEXCEPT = 0;
3775 
3786  virtual Dims getSize() const TRTNOEXCEPT = 0;
3787 
3797  virtual void setStride(Dims stride) TRTNOEXCEPT = 0;
3798 
3809  virtual Dims getStride() const TRTNOEXCEPT = 0;
3810 
3816  virtual void setMode(SliceMode mode) TRTNOEXCEPT = 0;
3817 
3823  virtual SliceMode getMode() const TRTNOEXCEPT = 0;
3824 
3844  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
3845 
3846 protected:
3847  virtual ~ISliceLayer() {}
3848 };
3849 
3862 class IShapeLayer : public ILayer
3863 {
3864 protected:
3865  virtual ~IShapeLayer() {}
3866 };
3867 
3873 enum class TopKOperation : int
3874 {
3875  kMAX = 0,
3876  kMIN = 1,
3877 };
3878 
3879 template <>
3880 constexpr inline int EnumMax<TopKOperation>()
3881 {
3882  return 2;
3883 }
3884 
3892 class ITopKLayer : public ILayer
3893 {
3894 public:
3900  virtual void setOperation(TopKOperation op) TRTNOEXCEPT = 0;
3901 
3907  virtual TopKOperation getOperation() const TRTNOEXCEPT = 0;
3908 
3916  virtual void setK(int k) TRTNOEXCEPT = 0;
3917 
3923  virtual int getK() const TRTNOEXCEPT = 0;
3924 
3930  virtual void setReduceAxes(uint32_t reduceAxes) TRTNOEXCEPT = 0;
3931 
3937  virtual uint32_t getReduceAxes() const TRTNOEXCEPT = 0;
3938 
3939 protected:
3940  virtual ~ITopKLayer() {}
3941 };
3942 
3949 enum class MatrixOperation : int
3950 {
3954  kNONE,
3955 
3957  kTRANSPOSE,
3958 
3968  kVECTOR
3969 };
3970 
3971 template <>
3972 constexpr inline int EnumMax<MatrixOperation>()
3973 {
3974  return 3;
3975 }
3976 
4003 {
4004 public:
4011  virtual void setOperation(int index, MatrixOperation op) TRTNOEXCEPT = 0;
4012 
4018  virtual MatrixOperation getOperation(int index) const TRTNOEXCEPT = 0;
4019 
4028  TRT_DEPRECATED virtual void setTranspose(int index, bool val) TRTNOEXCEPT = 0;
4029 
4037  TRT_DEPRECATED virtual bool getTranspose(int index) const TRTNOEXCEPT = 0;
4038 
4039 protected:
4040  virtual ~IMatrixMultiplyLayer() {}
4041 };
4042 
4058 {
4059 protected:
4060  virtual ~IRaggedSoftMaxLayer() {}
4061 };
4062 
4071 class IIdentityLayer : public ILayer
4072 {
4073 protected:
4074  virtual ~IIdentityLayer() {}
4075 };
4076 
4083 class IConstantLayer : public ILayer
4084 {
4085 public:
4095  virtual void setWeights(Weights weights) TRTNOEXCEPT = 0;
4096 
4102  virtual Weights getWeights() const TRTNOEXCEPT = 0;
4103 
4111  virtual void setDimensions(Dims dimensions) TRTNOEXCEPT = 0;
4112 
4120  virtual Dims getDimensions() const TRTNOEXCEPT = 0;
4121 
4122 protected:
4123  virtual ~IConstantLayer() {}
4124 };
4125 
4134 {
4135 protected:
4136  virtual ~IParametricReLULayer() noexcept {}
4137 };
4138 
4144 enum class ResizeMode : int
4145 {
4146  kNEAREST = 0, // ND (0 < N <= 8) nearest neighbor resizing.
4147  kLINEAR = 1 // Can handle linear (1D), bilinear (2D), and trilinear (3D) resizing.
4148 };
4149 
4150 template <>
4151 constexpr inline int EnumMax<ResizeMode>()
4152 {
4153  return 2;
4154 }
4155 
4176 class IResizeLayer : public ILayer
4177 {
4178 public:
4194  virtual void setOutputDimensions(Dims dimensions) TRTNOEXCEPT = 0;
4195 
4201  virtual Dims getOutputDimensions() const TRTNOEXCEPT = 0;
4202 
4221  virtual void setScales(const float* scales, int nbScales) TRTNOEXCEPT = 0;
4222 
4237  virtual int getScales(int size, float* scales) const TRTNOEXCEPT = 0;
4238 
4246  virtual void setResizeMode(ResizeMode resizeMode) TRTNOEXCEPT = 0;
4247 
4253  virtual ResizeMode getResizeMode() const TRTNOEXCEPT = 0;
4254 
4264  virtual void setAlignCorners(bool alignCorners) TRTNOEXCEPT = 0;
4265 
4271  virtual bool getAlignCorners() const TRTNOEXCEPT = 0;
4272 
4293  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
4294 
4295 protected:
4296  virtual ~IResizeLayer() {}
4297 };
4298 
4300 enum class LoopOutput : int
4301 {
4303  kLAST_VALUE = 0,
4304 
4306  kCONCATENATE = 1,
4307 
4309  kREVERSE = 2
4310 };
4311 
4312 template <>
4313 constexpr inline int EnumMax<LoopOutput>()
4314 {
4315  return 3;
4316 }
4317 
4319 enum class TripLimit : int
4320 {
4321  // Tensor is scalar of type kINT32 that contains the trip count.
4322  kCOUNT = 0,
4323 
4324  // Tensor is a scalar of type kBOOL. Loop terminates when value is false.
4325  kWHILE = 1
4326 };
4327 
4328 template <>
4329 constexpr inline int EnumMax<TripLimit>()
4330 {
4331  return 2;
4332 }
4333 
4334 class ILoop;
4335 
4337 {
4338 public:
4340  virtual ILoop* getLoop() const noexcept = 0;
4341 };
4342 
4344 {
4345 public:
4351  //
4364  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
4365 };
4366 
4385 {
4386 public:
4387  virtual LoopOutput getLoopOutput() const noexcept = 0;
4388 
4401  virtual void setAxis(int axis) noexcept = 0;
4402 
4404  virtual int getAxis() const noexcept = 0;
4405 
4411  //
4426  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
4427 };
4428 
4430 {
4431 public:
4432  virtual TripLimit getTripLimit() const noexcept = 0;
4433 };
4434 
4436 {
4437 public:
4439  virtual void setAxis(int axis) noexcept = 0;
4440 
4442  virtual int getAxis() const noexcept = 0;
4443 
4449  virtual void setReverse(bool reverse) noexcept = 0;
4450 
4452  virtual bool getReverse() const noexcept = 0;
4453 };
4454 
4458 class ILoop
4459 {
4460 public:
4466  //
4468  virtual IRecurrenceLayer* addRecurrence(ITensor& initialValue) noexcept = 0;
4469 
4486  virtual ITripLimitLayer* addTripLimit(ITensor& tensor, TripLimit limit) noexcept = 0;
4487 
4496  virtual IIteratorLayer* addIterator(ITensor& tensor, int axis = 0, bool reverse = false) noexcept = 0;
4497 
4505  virtual ILoopOutputLayer* addLoopOutput(ITensor& tensor, LoopOutput outputKind, int axis = 0) noexcept = 0;
4506 
4515  virtual void setName(const char* name) noexcept = 0;
4516 
4522  virtual const char* getName() const noexcept = 0;
4523 
4524 protected:
4525  virtual ~ILoop() {}
4526 };
4527 
4531 class ISelectLayer : public ILayer
4532 {
4533 protected:
4534  virtual ~ISelectLayer() {}
4535 };
4536 
4544 enum class FillOperation : int
4545 {
4546  kLINSPACE = 0,
4547  kRANDOM_UNIFORM = 1
4548 };
4549 
4550 template <>
4551 constexpr inline int EnumMax<FillOperation>()
4552 {
4553  return 2;
4554 }
4555 
4574 class IFillLayer : public ILayer
4575 {
4576 public:
4585  //
4586  virtual void setDimensions(Dims dimensions) noexcept = 0;
4587 
4598  virtual Dims getDimensions() const noexcept = 0;
4599 
4605  virtual void setOperation(FillOperation op) noexcept = 0;
4606 
4612  virtual FillOperation getOperation() const noexcept = 0;
4613 
4626  //
4627  virtual void setAlpha(double alpha) noexcept = 0;
4628 
4639  virtual double getAlpha() const noexcept = 0;
4640 
4654  virtual void setBeta(double beta) noexcept = 0;
4655 
4666  virtual double getBeta() const noexcept = 0;
4667 
4692  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
4693 
4694 protected:
4695  virtual ~IFillLayer() {}
4696 };
4697 
4718 {
4719 public:
4725 
4752  virtual ITensor* addInput(const char* name, DataType type, Dims dimensions) TRTNOEXCEPT = 0;
4753 
4761  virtual void markOutput(ITensor& tensor) TRTNOEXCEPT = 0;
4762 
4781  TRT_DEPRECATED virtual IConvolutionLayer* addConvolution(ITensor& input, int nbOutputMaps, DimsHW kernelSize,
4782  Weights kernelWeights, Weights biasWeights) TRTNOEXCEPT = 0;
4783 
4799  virtual IFullyConnectedLayer* addFullyConnected(
4800  ITensor& input, int nbOutputs, Weights kernelWeights, Weights biasWeights) TRTNOEXCEPT = 0;
4801 
4816  virtual IActivationLayer* addActivation(ITensor& input, ActivationType type) TRTNOEXCEPT = 0;
4817 
4832  TRT_DEPRECATED virtual IPoolingLayer* addPooling(
4833  ITensor& input, PoolingType type, DimsHW windowSize) TRTNOEXCEPT = 0;
4834 
4849  virtual ILRNLayer* addLRN(ITensor& input, int window, float alpha, float beta, float k) TRTNOEXCEPT = 0;
4850 
4870  virtual IScaleLayer* addScale(ITensor& input, ScaleMode mode, Weights shift, Weights scale, Weights power) TRTNOEXCEPT = 0;
4871 
4880  virtual ISoftMaxLayer* addSoftMax(ITensor& input) TRTNOEXCEPT = 0;
4881 
4894  virtual IConcatenationLayer* addConcatenation(ITensor* const* inputs, int nbInputs) TRTNOEXCEPT = 0;
4895 
4914  TRT_DEPRECATED virtual IDeconvolutionLayer* addDeconvolution(ITensor& input, int nbOutputMaps, DimsHW kernelSize,
4915  Weights kernelWeights, Weights biasWeights) TRTNOEXCEPT = 0;
4916 
4937  virtual IElementWiseLayer* addElementWise(ITensor& input1, ITensor& input2, ElementWiseOperation op) TRTNOEXCEPT = 0;
4938 
4997  TRT_DEPRECATED virtual IRNNLayer* addRNN(ITensor& inputs, int layerCount, std::size_t hiddenSize, int maxSeqLen,
4998  RNNOperation op, RNNInputMode mode, RNNDirection dir, Weights weights, Weights bias) TRTNOEXCEPT = 0;
4999 
5016  TRT_DEPRECATED virtual IPluginLayer* addPlugin(
5017  ITensor* const* inputs, int nbInputs, IPlugin& plugin) TRTNOEXCEPT = 0;
5018 
5031  virtual IUnaryLayer* addUnary(ITensor& input, UnaryOperation operation) TRTNOEXCEPT = 0;
5032 
5045  TRT_DEPRECATED virtual IPaddingLayer* addPadding(
5046  ITensor& input, DimsHW prePadding, DimsHW postPadding) TRTNOEXCEPT = 0;
5047 
5057  virtual IShuffleLayer* addShuffle(ITensor& input) TRTNOEXCEPT = 0;
5058 
5071  TRT_DEPRECATED virtual void setPoolingOutputDimensionsFormula(IOutputDimensionsFormula* formula) TRTNOEXCEPT = 0;
5072 
5082  TRT_DEPRECATED virtual IOutputDimensionsFormula& getPoolingOutputDimensionsFormula() const TRTNOEXCEPT = 0;
5083 
5098  TRT_DEPRECATED virtual void setConvolutionOutputDimensionsFormula(
5099  IOutputDimensionsFormula* formula) TRTNOEXCEPT = 0;
5100 
5112  TRT_DEPRECATED virtual IOutputDimensionsFormula& getConvolutionOutputDimensionsFormula() const TRTNOEXCEPT = 0;
5113 
5128  TRT_DEPRECATED virtual void setDeconvolutionOutputDimensionsFormula(
5129  IOutputDimensionsFormula* formula) TRTNOEXCEPT = 0;
5130 
5142  TRT_DEPRECATED virtual IOutputDimensionsFormula& getDeconvolutionOutputDimensionsFormula() const TRTNOEXCEPT = 0;
5143 
5151  virtual int getNbLayers() const TRTNOEXCEPT = 0;
5152 
5162  virtual ILayer* getLayer(int index) const TRTNOEXCEPT = 0;
5163 
5171  virtual int getNbInputs() const TRTNOEXCEPT = 0;
5172 
5182  virtual ITensor* getInput(int index) const TRTNOEXCEPT = 0; // adding inputs invalidates indexing here
5183 
5193  virtual int getNbOutputs() const TRTNOEXCEPT = 0;
5194 
5204  virtual ITensor* getOutput(int index) const TRTNOEXCEPT = 0; // adding outputs invalidates indexing here
5205 
5209  virtual void destroy() TRTNOEXCEPT = 0;
5210 
5211 protected:
5212  virtual ~INetworkDefinition() {}
5213 
5214 public:
5238  virtual IReduceLayer* addReduce(ITensor& input, ReduceOperation operation, uint32_t reduceAxes, bool keepDimensions) TRTNOEXCEPT = 0;
5239 
5268  virtual ITopKLayer* addTopK(ITensor& input, TopKOperation op, int k, uint32_t reduceAxes) TRTNOEXCEPT = 0;
5269 
5281  virtual IGatherLayer* addGather(ITensor& data, ITensor& indices, int axis) TRTNOEXCEPT = 0;
5282 
5296  virtual IRaggedSoftMaxLayer* addRaggedSoftMax(ITensor& input, ITensor& bounds) TRTNOEXCEPT = 0;
5297 
5312  virtual IMatrixMultiplyLayer* addMatrixMultiply(
5313  ITensor& input0, MatrixOperation op0, ITensor& input1, MatrixOperation op1) TRTNOEXCEPT = 0;
5314 
5331  TRT_DEPRECATED virtual IMatrixMultiplyLayer* addMatrixMultiply(
5332  ITensor& input0, bool transpose0, ITensor& input1, bool transpose1) TRTNOEXCEPT = 0;
5333 
5354  virtual IConstantLayer* addConstant(Dims dimensions, Weights weights) TRTNOEXCEPT = 0;
5355 
5417  virtual IRNNv2Layer* addRNNv2(
5418  ITensor& input, int32_t layerCount, int32_t hiddenSize, int32_t maxSeqLen, RNNOperation op) TRTNOEXCEPT = 0;
5419 
5436  TRT_DEPRECATED virtual IPluginLayer* addPluginExt(
5437  ITensor* const* inputs, int nbInputs, IPluginExt& plugin) TRTNOEXCEPT = 0;
5438 
5450  virtual IIdentityLayer* addIdentity(ITensor& input) TRTNOEXCEPT = 0;
5451 
5462  virtual void removeTensor(ITensor& tensor) TRTNOEXCEPT = 0;
5463 
5471  virtual void unmarkOutput(ITensor& tensor) TRTNOEXCEPT = 0;
5472 
5487  virtual IPluginV2Layer* addPluginV2(ITensor* const* inputs, int nbInputs, IPluginV2& plugin) TRTNOEXCEPT = 0;
5488 
5503  virtual ISliceLayer* addSlice(ITensor& input, Dims start, Dims size, Dims stride) TRTNOEXCEPT = 0;
5504 
5522  virtual void setName(const char* name) TRTNOEXCEPT = 0;
5523 
5533  virtual const char* getName() const TRTNOEXCEPT = 0;
5534 
5548  virtual IShapeLayer* addShape(ITensor& input) TRTNOEXCEPT = 0;
5549 
5564  virtual bool hasImplicitBatchDimension() const TRTNOEXCEPT = 0;
5565 
5579  virtual bool markOutputForShapes(ITensor& tensor) TRTNOEXCEPT = 0;
5580 
5588  virtual bool unmarkOutputForShapes(ITensor& tensor) TRTNOEXCEPT = 0;
5589 
5603  virtual IParametricReLULayer* addParametricReLU(ITensor& input, ITensor& slope) noexcept = 0;
5604 
5622  virtual IConvolutionLayer* addConvolutionNd(
5623  ITensor& input, int nbOutputMaps, Dims kernelSize, Weights kernelWeights, Weights biasWeights) TRTNOEXCEPT = 0;
5624 
5639  virtual IPoolingLayer* addPoolingNd(ITensor& input, PoolingType type, Dims windowSize) TRTNOEXCEPT = 0;
5640 
5655  //
5658  virtual IDeconvolutionLayer* addDeconvolutionNd(
5659  ITensor& input, int nbOutputMaps, Dims kernelSize, Weights kernelWeights, Weights biasWeights) TRTNOEXCEPT = 0;
5660 
5682  virtual IScaleLayer* addScaleNd(ITensor& input, ScaleMode mode, Weights shift, Weights scale, Weights power, int channelAxis) TRTNOEXCEPT = 0;
5683 
5694  virtual IResizeLayer* addResize(ITensor& input) TRTNOEXCEPT = 0;
5695 
5706  virtual bool hasExplicitPrecision() const TRTNOEXCEPT = 0;
5707 
5717  virtual ILoop* addLoop() noexcept = 0;
5718 
5728  virtual ISelectLayer* addSelect(ITensor& condition, ITensor& thenInput, ITensor& elseInput) TRTNOEXCEPT = 0;
5729 
5740  virtual IFillLayer* addFill(Dims dimensions, FillOperation op) noexcept = 0;
5741 
5752  TRT_DEPRECATED virtual IPaddingLayer* addPaddingNd(
5753  ITensor& input, Dims prePadding, Dims postPadding) TRTNOEXCEPT = 0;
5754 };
5755 
5761 enum class CalibrationAlgoType : int
5762 {
5763  kLEGACY_CALIBRATION = 0,
5764  kENTROPY_CALIBRATION = 1,
5765  kENTROPY_CALIBRATION_2 = 2,
5766  kMINMAX_CALIBRATION = 3,
5767 };
5768 
5769 template <>
5770 constexpr inline int EnumMax<CalibrationAlgoType>()
5771 {
5772  return 4;
5773 }
5774 
5787 {
5788 public:
5794  virtual int getBatchSize() const TRTNOEXCEPT = 0;
5795 
5809  virtual bool getBatch(void* bindings[], const char* names[], int nbBindings) TRTNOEXCEPT = 0;
5810 
5825  virtual const void* readCalibrationCache(std::size_t& length) TRTNOEXCEPT = 0;
5826 
5835  virtual void writeCalibrationCache(const void* ptr, std::size_t length) TRTNOEXCEPT = 0;
5836 
5842  virtual CalibrationAlgoType getAlgorithm() TRTNOEXCEPT = 0;
5843 
5844  virtual ~IInt8Calibrator() {}
5845 };
5846 
5852 {
5853 public:
5857  CalibrationAlgoType getAlgorithm() TRTNOEXCEPT override { return CalibrationAlgoType::kENTROPY_CALIBRATION; }
5858 
5859  virtual ~IInt8EntropyCalibrator() {}
5860 };
5861 
5867 {
5868 public:
5872  CalibrationAlgoType getAlgorithm() TRTNOEXCEPT override { return CalibrationAlgoType::kENTROPY_CALIBRATION_2; }
5873 
5874  virtual ~IInt8EntropyCalibrator2() {}
5875 };
5876 
5882 {
5883 public:
5887  CalibrationAlgoType getAlgorithm() TRTNOEXCEPT override { return CalibrationAlgoType::kMINMAX_CALIBRATION; }
5888 
5889  virtual ~IInt8MinMaxCalibrator() {}
5890 };
5891 
5895 class TRT_DEPRECATED IInt8LegacyCalibrator : public IInt8Calibrator
5896 {
5897 public:
5901  CalibrationAlgoType getAlgorithm() TRTNOEXCEPT override { return CalibrationAlgoType::kLEGACY_CALIBRATION; }
5902 
5909  virtual double getQuantile() const TRTNOEXCEPT = 0;
5910 
5917  virtual double getRegressionCutoff() const TRTNOEXCEPT = 0;
5918 
5931  virtual const void* readHistogramCache(std::size_t& length) TRTNOEXCEPT = 0;
5932 
5941  virtual void writeHistogramCache(const void* ptr, std::size_t length) TRTNOEXCEPT = 0;
5942 
5943  virtual ~IInt8LegacyCalibrator() {}
5944 };
5945 
5952 typedef uint32_t BuilderFlags;
5953 
5961 enum class BuilderFlag : int
5962 {
5963  kFP16 = 0,
5964  kINT8 = 1,
5965  kDEBUG = 2,
5966  kGPU_FALLBACK = 3,
5967  kSTRICT_TYPES = 4,
5968  kREFIT = 5,
5969 };
5970 
5971 template <>
5972 constexpr inline int EnumMax<BuilderFlag>()
5973 {
5974  return 6;
5975 }
5976 
5983 {
5984 public:
5995  virtual void setMinTimingIterations(int minTiming) TRTNOEXCEPT = 0;
5996 
6004  virtual int getMinTimingIterations() const TRTNOEXCEPT = 0;
6005 
6014  virtual void setAvgTimingIterations(int avgTiming) TRTNOEXCEPT = 0;
6015 
6023  virtual int getAvgTimingIterations() const TRTNOEXCEPT = 0;
6024 
6033  virtual void setEngineCapability(EngineCapability capability) TRTNOEXCEPT = 0;
6034 
6042  virtual EngineCapability getEngineCapability() const TRTNOEXCEPT = 0;
6043 
6049  virtual void setInt8Calibrator(IInt8Calibrator* calibrator) TRTNOEXCEPT = 0;
6050 
6054  virtual IInt8Calibrator* getInt8Calibrator() const TRTNOEXCEPT = 0;
6055 
6063  virtual void setMaxWorkspaceSize(std::size_t workspaceSize) TRTNOEXCEPT = 0;
6064 
6074  virtual std::size_t getMaxWorkspaceSize() const TRTNOEXCEPT = 0;
6075 
6088  virtual void setFlags(BuilderFlags builderFlags) TRTNOEXCEPT = 0;
6089 
6097  virtual BuilderFlags getFlags() const TRTNOEXCEPT = 0;
6098 
6106  virtual void clearFlag(BuilderFlag builderFlag) TRTNOEXCEPT = 0;
6107 
6115  virtual void setFlag(BuilderFlag builderFlag) TRTNOEXCEPT = 0;
6116 
6126  virtual bool getFlag(BuilderFlag builderFlag) const TRTNOEXCEPT = 0;
6127 
6128 
6139  virtual void setDeviceType(const ILayer* layer, DeviceType deviceType) TRTNOEXCEPT = 0;
6140 
6145  virtual DeviceType getDeviceType(const ILayer* layer) const TRTNOEXCEPT = 0;
6146 
6152  virtual bool isDeviceTypeSet(const ILayer* layer) const TRTNOEXCEPT = 0;
6153 
6159  virtual void resetDeviceType(const ILayer* layer) TRTNOEXCEPT = 0;
6160 
6165  virtual bool canRunOnDLA(const ILayer* layer) const TRTNOEXCEPT = 0;
6166 
6175  virtual void setDLACore(int dlaCore) TRTNOEXCEPT = 0;
6176 
6181  virtual int getDLACore() const TRTNOEXCEPT = 0;
6182 
6188  virtual void setDefaultDeviceType(DeviceType deviceType) TRTNOEXCEPT = 0;
6189 
6195  virtual DeviceType getDefaultDeviceType() const TRTNOEXCEPT = 0;
6196 
6202  virtual void reset() TRTNOEXCEPT = 0;
6203 
6209  virtual void destroy() TRTNOEXCEPT = 0;
6210 
6218  virtual void setProfileStream(const cudaStream_t stream) TRTNOEXCEPT = 0;
6219 
6227  virtual cudaStream_t getProfileStream() const TRTNOEXCEPT = 0;
6228 
6240  virtual int addOptimizationProfile(const IOptimizationProfile* profile) noexcept = 0;
6241 
6248  virtual int getNbOptimizationProfiles() const noexcept = 0;
6249 
6250 protected:
6251  virtual ~IBuilderConfig()
6252  {
6253  }
6254 };
6255 
6256 
6266 
6277 {
6282  kEXPLICIT_BATCH = 0,
6283 
6296  kEXPLICIT_PRECISION = 1,
6297 };
6298 template <>
6299 constexpr inline int EnumMax<NetworkDefinitionCreationFlag>()
6300 {
6301  return 2;
6302 }
6303 
6304 
6313 {
6314 public:
6326  TRT_DEPRECATED virtual nvinfer1::INetworkDefinition* createNetwork() TRTNOEXCEPT = 0;
6327 
6336  virtual void setMaxBatchSize(int batchSize) TRTNOEXCEPT = 0;
6337 
6346  virtual int getMaxBatchSize() const TRTNOEXCEPT = 0;
6347 
6357  TRT_DEPRECATED virtual void setMaxWorkspaceSize(std::size_t workspaceSize) TRTNOEXCEPT = 0;
6358 
6368  TRT_DEPRECATED virtual std::size_t getMaxWorkspaceSize() const TRTNOEXCEPT = 0;
6369 
6382  TRT_DEPRECATED virtual void setHalf2Mode(bool mode) TRTNOEXCEPT = 0;
6383 
6391  TRT_DEPRECATED virtual bool getHalf2Mode() const TRTNOEXCEPT = 0;
6392 
6401  TRT_DEPRECATED virtual void setDebugSync(bool sync) TRTNOEXCEPT = 0;
6402 
6410  TRT_DEPRECATED virtual bool getDebugSync() const TRTNOEXCEPT = 0;
6411 
6422  TRT_DEPRECATED virtual void setMinFindIterations(int minFind) TRTNOEXCEPT = 0;
6423 
6431  TRT_DEPRECATED virtual int getMinFindIterations() const TRTNOEXCEPT = 0;
6432 
6443  TRT_DEPRECATED virtual void setAverageFindIterations(int avgFind) TRTNOEXCEPT = 0;
6444 
6452  TRT_DEPRECATED virtual int getAverageFindIterations() const TRTNOEXCEPT = 0;
6453 
6461  TRT_DEPRECATED virtual nvinfer1::ICudaEngine* buildCudaEngine(
6462  nvinfer1::INetworkDefinition& network) TRTNOEXCEPT = 0;
6463 
6467  virtual bool platformHasFastFp16() const TRTNOEXCEPT = 0;
6468 
6472  virtual bool platformHasFastInt8() const TRTNOEXCEPT = 0;
6473 
6477  virtual void destroy() TRTNOEXCEPT = 0;
6478 
6490  TRT_DEPRECATED virtual void setInt8Mode(bool mode) TRTNOEXCEPT = 0;
6491 
6499  TRT_DEPRECATED virtual bool getInt8Mode() const TRTNOEXCEPT = 0;
6500 
6506  TRT_DEPRECATED virtual void setInt8Calibrator(IInt8Calibrator* calibrator) TRTNOEXCEPT = 0;
6507 
6520  TRT_DEPRECATED virtual void setDeviceType(ILayer* layer, DeviceType deviceType) TRTNOEXCEPT = 0;
6521 
6528  TRT_DEPRECATED virtual DeviceType getDeviceType(const ILayer* layer) const TRTNOEXCEPT = 0;
6529 
6537  TRT_DEPRECATED virtual bool isDeviceTypeSet(const ILayer* layer) const TRTNOEXCEPT = 0;
6538 
6546  TRT_DEPRECATED virtual void resetDeviceType(ILayer* layer) TRTNOEXCEPT = 0;
6547 
6552  TRT_DEPRECATED virtual bool canRunOnDLA(const ILayer* layer) const TRTNOEXCEPT = 0;
6553 
6561  TRT_DEPRECATED virtual void setDefaultDeviceType(DeviceType deviceType) TRTNOEXCEPT = 0;
6562 
6568  TRT_DEPRECATED virtual DeviceType getDefaultDeviceType() const TRTNOEXCEPT = 0;
6569 
6577  virtual int getMaxDLABatchSize() const TRTNOEXCEPT = 0;
6578 
6588  TRT_DEPRECATED virtual void allowGPUFallback(bool setFallBackMode) TRTNOEXCEPT = 0;
6589 
6593  virtual int getNbDLACores() const TRTNOEXCEPT = 0;
6594 
6605  TRT_DEPRECATED virtual void setDLACore(int dlaCore) TRTNOEXCEPT = 0;
6606 
6613  TRT_DEPRECATED virtual int getDLACore() const TRTNOEXCEPT = 0;
6614 
6620  TRT_DEPRECATED virtual void reset(nvinfer1::INetworkDefinition& network) TRTNOEXCEPT = 0;
6621 
6622 protected:
6623  virtual ~IBuilder()
6624  {
6625  }
6626 
6627 public:
6639  virtual void setGpuAllocator(IGpuAllocator* allocator) TRTNOEXCEPT = 0;
6640 
6652  TRT_DEPRECATED virtual void setFp16Mode(bool mode) TRTNOEXCEPT = 0;
6653 
6661  TRT_DEPRECATED virtual bool getFp16Mode() const TRTNOEXCEPT = 0;
6662 
6681  TRT_DEPRECATED virtual void setStrictTypeConstraints(bool mode) TRTNOEXCEPT = 0;
6682 
6690  TRT_DEPRECATED virtual bool getStrictTypeConstraints() const TRTNOEXCEPT = 0;
6691 
6697  TRT_DEPRECATED virtual void setRefittable(bool canRefit) TRTNOEXCEPT = 0;
6698 
6706  TRT_DEPRECATED virtual bool getRefittable() const TRTNOEXCEPT = 0;
6707 
6713  TRT_DEPRECATED virtual void setEngineCapability(EngineCapability capability) TRTNOEXCEPT = 0;
6714 
6722  TRT_DEPRECATED virtual EngineCapability getEngineCapability() const TRTNOEXCEPT = 0;
6723 
6729  virtual nvinfer1::IBuilderConfig* createBuilderConfig() TRTNOEXCEPT = 0;
6730 
6737  virtual nvinfer1::ICudaEngine* buildEngineWithConfig(
6738  INetworkDefinition& network, IBuilderConfig& config) TRTNOEXCEPT = 0;
6739 
6740 
6752  virtual nvinfer1::INetworkDefinition* createNetworkV2(NetworkDefinitionCreationFlags flags) TRTNOEXCEPT = 0;
6753 
6754 
6764  virtual nvinfer1::IOptimizationProfile* createOptimizationProfile() noexcept = 0;
6765 
6775  //
6778  virtual void setErrorRecorder(IErrorRecorder* recorder) TRTNOEXCEPT = 0;
6779 
6790  virtual IErrorRecorder* getErrorRecorder() const TRTNOEXCEPT = 0;
6791 
6795  virtual void reset() TRTNOEXCEPT = 0;
6796 };
6797 
6798 } // namespace nvinfer1
6799 
6804 extern "C" TENSORRTAPI void* createInferBuilder_INTERNAL(void* logger, int version);
6805 
6806 namespace nvinfer1
6807 {
6808 namespace
6809 {
6818 {
6819  return static_cast<IBuilder*>(createInferBuilder_INTERNAL(&logger, NV_TENSORRT_VERSION));
6820 }
6821 }
6822 }
6823 
6824 #endif
int w() const
Get the width.
Definition: NvInfer.h:400
int n() const
Get the index count.
Definition: NvInfer.h:358
Use SAME padding, with prePadding <= postPadding.
An engine for executing inference on a built network, with functionally unsafe features.
Definition: NvInferRuntime.h:1115
Substract the second element from the first.
Perform the normal matrix multiplication in the first recurrent layer.
DataType
The type of weights and tensors.
Definition: NvInferRuntimeCommon.h:162
PaddingMode
Enumerates the modes of padding to perform in convolution, deconvolution and pooling layer...
Definition: NvInfer.h:1100
NetworkDefinitionCreationFlag
List of immutable network properties expressed at network creation time. NetworkDefinitionCreationFla...
Definition: NvInfer.h:6276
DimsNCHW(int batchSize, int channels, int height, int width)
Construct a DimsNCHW given batch size, channel count, height and width.
Definition: NvInfer.h:338
constexpr int EnumMax< CalibrationAlgoType >()
Maximum number of elements in CalibrationAlgoType enum.
Definition: NvInfer.h:5770
RNNOperation
Enumerates the RNN operations that may be performed by an RNN layer.
Definition: NvInfer.h:2653
Logical XOR of two elements.
Check if element in first tensor is less than corresponding element in second tensor.
A Softmax layer in a network definition.
Definition: NvInfer.h:2090
constexpr int EnumMax< TripLimit >()
Maximum number of elements in TripLimit enum.
Definition: NvInfer.h:4329
Check if two elements are equal.
MatrixOperation
Enumerates the operations that may be performed on a tensor by IMatrixMultiplyLayer before multiplica...
Definition: NvInfer.h:3949
Loop Iterator layer.
Definition: NvInfer.h:3567
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:344
constexpr int EnumMax< RNNDirection >()
Maximum number of elements in RNNDirection enum.
Definition: NvInfer.h:2681
Single gate RNN w/ TANH activation function.
Layer that represents an unary operation.
Definition: NvInfer.h:3372
Check if element in first tensor is greater than corresponding element in second tensor.
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: NvInferRuntimeCommon.h:112
An Activation layer in a network definition.
Definition: NvInfer.h:1559
IBuilder * createInferBuilder(ILogger &logger)
Create an instance of an IBuilder class.
Definition: NvInfer.h:6817
BuilderFlag
Definition: NvInfer.h:5961
constexpr int EnumMax< PaddingMode >()
Maximum number of elements in PaddingMode enum.
Definition: NvInfer.h:1111
int w() const
Get the width.
Definition: NvInfer.h:273
RNNDirection
Enumerates the RNN direction that may be performed by an RNN layer.
Definition: NvInfer.h:2674
Layer that represents a Matrix Multiplication.
Definition: NvInfer.h:4002
DimsCHW()
Construct an empty DimsCHW object.
Definition: NvInfer.h:212
No operation is performed on the first recurrent layer.
int c() const
Get the channel count.
Definition: NvInfer.h:372
Holds properties for configuring a builder to produce an engine.
Definition: NvInfer.h:5982
CalibrationAlgoType getAlgorithm() override
Definition: NvInfer.h:5872
constexpr int EnumMax< RNNOperation >()
Maximum number of elements in RNNOperation enum.
Definition: NvInfer.h:2662
int h() const
Get the height.
Definition: NvInfer.h:386
A convolution layer in a network definition.
Definition: NvInfer.h:1128
Definition: NvInfer.h:4336
A RaggedSoftmax layer in a network definition.
Definition: NvInfer.h:4057
ScaleMode
Controls how shift, scale and power are applied in a Scale layer.
Definition: NvInfer.h:1966
Coordinates wrap around periodically.
Plugin class for user-implemented layers.
Definition: NvInferRuntime.h:134
Layer that represents a constant value.
Definition: NvInfer.h:4083
Logical AND of two elements.
A Scale layer in a network definition.
Definition: NvInfer.h:2001
Layer type for getting shape of a tensor.
Definition: NvInfer.h:3862
Enable FP16 layer selection, with FP32 fallback.
Use SAME padding, with prePadding >= postPadding.
Definition: NvInfer.h:4458
static const int MAX_DIMS
The maximum number of dimensions supported for a tensor.
Definition: NvInferRuntimeCommon.h:209
A fully connected layer in a network definition. This layer expects an input tensor of three or more ...
Definition: NvInfer.h:1476
Use CAFFE padding, rounding output size down, uses prePadding value.
Layer that represents a parametric ReLU operation.
Definition: NvInfer.h:4133
int w() const
Get the width.
Definition: NvInfer.h:165
ReduceOperation
Enumerates the reduce operations that may be performed by a Reduce layer.
Definition: NvInfer.h:3398
A LRN layer in a network definition.
Definition: NvInfer.h:1894
Descriptor for three-dimensional data.
Definition: NvInfer.h:172
Fail with error when the coordinates are out of bounds. This is the default.
constexpr int EnumMax< ElementWiseOperation >()
Maximum number of elements in ElementWiseOperation enum.
Definition: NvInfer.h:2491
uint32_t BuilderFlags
It is capable of representing one or more BuilderFlags by binary OR operations, e.g., 1U << BuilderFlag::kFP16 | 1U << BuilderFlag::kDEBUG.
Definition: NvInfer.h:5952
TensorLocation
The location for tensor data storage, device or host.
Definition: NvInferRuntimeCommon.h:926
UnaryOp operation Layer.
Definition: NvInfer.h:2537
Builds an engine from a network definition.
Definition: NvInfer.h:6312
Generate evenly spaced numbers over a specified interval.
Layer that represents a TopK reduction.
Definition: NvInfer.h:3892
An RNN layer in a network definition, version 2.
Definition: NvInfer.h:3086
int & h()
Get the height.
Definition: NvInfer.h:252
Per-channel coefficients.
Elements correspond to different spatial data.
The TensorRT API version 1 namespace.
constexpr int EnumMax< LayerType >()
Maximum number of elements in LayerType enum.
Definition: NvInfer.h:449
CalibrationAlgoType getAlgorithm() override
Definition: NvInfer.h:5887
int & n()
Get the index count.
Definition: NvInfer.h:351
int c() const
Get the channel count.
Definition: NvInfer.h:245
int & w()
Get the width.
Definition: NvInfer.h:266
Layer that represents a reduction operator across Shape, Int32, Float, and Half tensors.
Definition: NvInfer.h:3420
Definition: NvInfer.h:5895
PoolingType
The type of pooling to perform in a pooling layer.
Definition: NvInfer.h:1620
int h() const
Get the height.
Definition: NvInfer.h:259
Generate an output tensor with specified mode.
Definition: NvInfer.h:4574
Sum of the two elements.
SliceMode
Controls how ISliceLayer handles out of bounds coordinates.
Definition: NvInfer.h:3699
Inverse hyperbolic tangent.
int & w()
Get the width.
Definition: NvInfer.h:158
CalibrationAlgoType getAlgorithm() override
Definition: NvInfer.h:5901
constexpr int EnumMax< FillOperation >()
Maximum number of elements in FillOperation enum.
Definition: NvInfer.h:4551
Descriptor for data with one channel dimension and two spatial dimensions.
Definition: NvInfer.h:206
The first element to the power of the second element.
A network definition for input to the builder.
Definition: NvInfer.h:4717
Like kNONE, but transpose the matrix dimensions.
Output value is concatenation of values of tensor for each iteration, in forward order.
Definition: NvInfer.h:4343
Divide the first element by the second.
Layer type for pluginV2.
Definition: NvInfer.h:3313
Product of the two elements.
Gauss error function.
Dims2()
Construct an empty Dims2 object.
Definition: NvInfer.h:91
TopKOperation
Enumerates the operations that may be performed by a TopK layer.
Definition: NvInfer.h:3873
Loop Trip limit layer.
Dims3(int d0, int d1, int d2)
Construct a Dims3 from 3 elements.
Definition: NvInfer.h:191
Descriptor for four-dimensional data.
Definition: NvInfer.h:280
ActivationType
Forward declare IGpuAllocator for use in other interfaces.
Definition: NvInferRuntimeCommon.h:133
Descriptor for data with one index dimension, one channel dimension and two spatial dimensions...
Definition: NvInfer.h:316
TRT_DEPRECATED DimensionType type[MAX_DIMS]
The type of each dimension.
Definition: NvInferRuntimeCommon.h:212
Optimization profile for dynamic input dimensions and shape tensors.
Definition: NvInferRuntime.h:997
Inverse hyperbolic cosine.
A resize layer in a network definition.
Definition: NvInfer.h:4176
constexpr int EnumMax< BuilderFlag >()
Maximum number of builder flags in BuilderFlag enum.
Definition: NvInfer.h:5972
DimsHW()
Construct an empty DimsHW object.
Definition: NvInfer.h:121
Use explicit padding, rounding output size up.
Base class for all layer classes in a network definition.
Definition: NvInfer.h:704
Reference counted application-implemented error reporting interface for TensorRT objects.
Definition: NvInferRuntimeCommon.h:1142
Dims4(int d0, int d1, int d2, int d3)
Construct a Dims4 from 4 elements.
Definition: NvInfer.h:300
Slices an input tensor into an output tensor based on the offset and strides.
Definition: NvInfer.h:3739
int & h()
Get the height.
Definition: NvInfer.h:379
int & h()
Get the height.
Definition: NvInfer.h:144
Mark the network to be an explicit batch network.
Enables strict type constraints.
int & c()
Get the channel count.
Definition: NvInfer.h:365
Structure to define the dimensions of a tensor.
Definition: NvInferRuntimeCommon.h:206
Network iterates from first to last and vice versa and outputs concatenated.
Layer type for shuffling data.
Definition: NvInfer.h:3590
DimsCHW(int channels, int height, int width)
Construct a DimsCHW given channel count, height and width.
Definition: NvInfer.h:226
Definition: NvInfer.h:5866
LoopOutput
Enum that describes kinds of loop outputs.
Definition: NvInfer.h:4300
A elementwise layer in a network definition.
Definition: NvInfer.h:2507
A Pooling layer in a network definition.
Definition: NvInfer.h:1641
constexpr int EnumMax< UnaryOperation >()
Maximum number of elements in UnaryOperation enum.
Definition: NvInfer.h:3360
int d[MAX_DIMS]
The extent of each dimension.
Definition: NvInferRuntimeCommon.h:211
Application-implemented interface to compute layer output sizes.
Definition: NvInfer.h:3256
Minimum of the two elements.
constexpr int EnumMax< LoopOutput >()
Maximum number of elements in LoopOutput enum.
Definition: NvInfer.h:4313
constexpr int EnumMax< SliceMode >()
Maximum number of elements in SliceMode enum.
Definition: NvInfer.h:3706
ElementWiseOperation
Enumerates the binary operations that may be performed by an ElementWise layer.
Definition: NvInfer.h:2472
Three-gate network consisting of Gated Recurrent Units.
RNNGateType
Identifies an individual gate within an RNN cell.
Definition: NvInfer.h:3060
Network iterations from first input to last input.
Output value is value of tensor for last iteration.
int & c()
Get the channel count.
Definition: NvInfer.h:238
Single gate RNN w/ ReLU activation function.
Dims3()
Construct an empty Dims3 object.
Definition: NvInfer.h:178
uint32_t TensorFormats
It is capable of representing one or more TensorFormat by binary OR operations, e.g., 1U << TensorFormats::kCHW4 | 1U << TensorFormats::kCHW32.
Definition: NvInferRuntimeCommon.h:221
A tensor in a network definition.
Definition: NvInfer.h:463
Logical OR of two elements.
An array of weights used as a layer parameter.
Definition: NvInferRuntime.h:98
int & w()
Get the width.
Definition: NvInfer.h:393
int h() const
Get the height.
Definition: NvInfer.h:151
Enable Int8 layer selection, with FP32 fallback with FP16 fallback if kFP16 also specified.
Mark the network to be an explicit precision network.
Dims2(int d0, int d1)
Construct a Dims2 from 2 elements.
Definition: NvInfer.h:103
Enable building a refittable engine.
Dims4()
Construct an empty Dims2 object.
Definition: NvInfer.h:286
int nbDims
The number of dimensions.
Definition: NvInferRuntimeCommon.h:210
Application-implemented interface for calibration.
Definition: NvInfer.h:5786
Generate a tensor with random values drawn from a uniform distribution.
Application-implemented logging interface for the builder, engine and runtime.
Definition: NvInferRuntimeCommon.h:986
DimsHW(int height, int width)
Construct a DimsHW given height and width.
Definition: NvInfer.h:133
constexpr int EnumMax< ReduceOperation >()
Maximum number of elements in ReduceOperation enum.
Definition: NvInfer.h:3408
Identical coefficients across all elements of the tensor.
Plugin class for user-implemented layers.
Definition: NvInferRuntime.h:238
Layer that represents a padding operation.
Definition: NvInfer.h:3479
Floor division of the first element by the second.
Definition: NvInfer.h:5881
constexpr int EnumMax< RNNGateType >()
Maximum number of elements in RNNGateType enum.
Definition: NvInfer.h:3072
constexpr int EnumMax< RNNInputMode >()
Maximum number of elements in RNNInputMode enum.
Definition: NvInfer.h:2708
Enable debugging of layers via synchronizing after every layer.
CalibrationAlgoType
Version of calibration algorithm to use.
Definition: NvInfer.h:5761
EngineCapability
Forward declaration of IPluginFactory for use by other interfaces.
Definition: NvInferRuntime.h:76
Enable layers marked to execute on GPU if layer cannot execute on DLA.
Use explicit padding, rounding output size down.
DimsNCHW()
Construct an empty DimsNCHW object.
Definition: NvInfer.h:322
LayerType
The type values of layer classes.
Definition: NvInfer.h:410
A layer that represents the identity function.
Definition: NvInfer.h:4071
Definition: NvInfer.h:4429
RNNInputMode
Enumerates the RNN input modes that may occur with an RNN layer.
Definition: NvInfer.h:2701
A RNN layer in a network definition.
Definition: NvInfer.h:2726
Definition: NvInfer.h:4435
Layer type for plugins.
Definition: NvInfer.h:3290
FillOperation
Enumerates the tensor fill operations that may performed by a fill layer.
Definition: NvInfer.h:4544
uint32_t NetworkDefinitionCreationFlags
This bitset is capable of representing one or more NetworkDefinitionCreationFlag flags constructed wi...
Definition: NvInfer.h:6265
Four-gate LSTM network w/o peephole connections.
constexpr int EnumMax< MatrixOperation >()
Maximum number of elements in MatrixOperation enum.
Definition: NvInfer.h:3972
Output value is concatenation of values of tensor for each iteration, in reverse order.
TripLimit
Enum that describes kinds of trip limits.
Definition: NvInfer.h:4319
#define _TENSORRT_OVERRIDE
Items that are marked as deprecated will be removed in a future release.
Definition: NvInferRuntimeCommon.h:62
Application-implemented class for controlling allocation on the GPU.
Definition: NvInferRuntimeCommon.h:943
constexpr int EnumMax< TopKOperation >()
Maximum number of elements in TopKOperation enum.
Definition: NvInfer.h:3880
constexpr int EnumMax< PoolingType >()
Maximum number of elements in PoolingType enum.
Definition: NvInfer.h:1628
constexpr int EnumMax< ScaleMode >()
Maximum number of elements in ScaleMode enum.
Definition: NvInfer.h:1974
Descriptor for two-dimensional spatial data.
Definition: NvInfer.h:115
UnaryOperation
Enumerates the unary operations that may be performed by a Unary layer.
Definition: NvInfer.h:3334
Definition: NvInfer.h:4531
constexpr int EnumMax< ResizeMode >()
Maximum number of elements in ResizeMode enum.
Definition: NvInfer.h:4151
DeviceType
The device that this layer/network will execute on.
Definition: NvInferRuntime.h:675
Elements correspond to different batch index.
Descriptor for two-dimensional data.
Definition: NvInfer.h:85
A concatenation layer in a network definition.
Definition: NvInfer.h:2145
ResizeMode
Enumerates various modes of resize in the resize layer. Resize mode set using setResizeMode().
Definition: NvInfer.h:4144
CalibrationAlgoType getAlgorithm() override
Definition: NvInfer.h:5857
Inverse hyperbolic sine.
A deconvolution layer in a network definition.
Definition: NvInfer.h:2178
Definition: NvInfer.h:4384
Use CAFFE padding, rounding output size up, uses prePadding value.
Loop Recurrence layer.
Definition: NvInfer.h:5851