TensorRT  6.0.1.5
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 };
441 
442 template <>
443 constexpr inline int EnumMax<LayerType>()
444 {
445  return 28;
446 }
447 
457 class ITensor
458 {
459 public:
472  virtual void setName(const char* name) TRTNOEXCEPT = 0;
473 
481  virtual const char* getName() const TRTNOEXCEPT = 0;
482 
497  virtual void setDimensions(Dims dimensions) TRTNOEXCEPT = 0; // only valid for input tensors
498 
507  virtual Dims getDimensions() const TRTNOEXCEPT = 0;
508 
519  virtual void setType(DataType type) TRTNOEXCEPT = 0;
520 
528  virtual DataType getType() const TRTNOEXCEPT = 0;
529 
540  virtual bool setDynamicRange(float min, float max) TRTNOEXCEPT = 0;
541 
549  TRT_DEPRECATED virtual float getDynamicRange() const TRTNOEXCEPT = 0;
550 
554  virtual bool isNetworkInput() const TRTNOEXCEPT = 0;
555 
559  virtual bool isNetworkOutput() const TRTNOEXCEPT = 0;
560 
561 protected:
562  virtual ~ITensor() {}
563 
564 public:
582  virtual void setBroadcastAcrossBatch(bool broadcastAcrossBatch) TRTNOEXCEPT = 0;
583 
595  virtual bool getBroadcastAcrossBatch() const TRTNOEXCEPT = 0;
596 
602  virtual TensorLocation getLocation() const TRTNOEXCEPT = 0;
603 
614  virtual void setLocation(TensorLocation location) TRTNOEXCEPT = 0;
615 
621  virtual bool dynamicRangeIsSet() const TRTNOEXCEPT = 0;
622 
626  virtual void resetDynamicRange() TRTNOEXCEPT = 0;
627 
633  virtual float getDynamicRangeMin() const TRTNOEXCEPT = 0;
634 
640  virtual float getDynamicRangeMax() const TRTNOEXCEPT = 0;
641 
650  virtual void setAllowedFormats(TensorFormats formats) TRTNOEXCEPT = 0;
651 
660  virtual TensorFormats getAllowedFormats() const TRTNOEXCEPT = 0;
661 
672  virtual bool isShapeTensor() const TRTNOEXCEPT = 0;
673 
688  virtual bool isExecutionTensor() const TRTNOEXCEPT = 0;
689 };
690 
698 class ILayer
699 {
700 public:
706  virtual LayerType getType() const TRTNOEXCEPT = 0;
707 
715  virtual void setName(const char* name) TRTNOEXCEPT = 0;
716 
720 
723  virtual const char* getName() const TRTNOEXCEPT = 0;
724 
728  virtual int getNbInputs() const TRTNOEXCEPT = 0;
729 
738  virtual ITensor* getInput(int index) const TRTNOEXCEPT = 0;
739 
743  virtual int getNbOutputs() const TRTNOEXCEPT = 0;
744 
751  virtual ITensor* getOutput(int index) const TRTNOEXCEPT = 0;
752 
764  virtual void setInput(int index, ITensor& tensor) TRTNOEXCEPT = 0;
765 
780 
781  virtual void setPrecision(DataType dataType) TRTNOEXCEPT = 0;
782 
789 
790  virtual DataType getPrecision() const TRTNOEXCEPT = 0;
791 
798 
799  virtual bool precisionIsSet() const TRTNOEXCEPT = 0;
800 
805 
806  virtual void resetPrecision() TRTNOEXCEPT = 0;
807 
825 
826  virtual void setOutputType(int index, DataType dataType) TRTNOEXCEPT = 0;
827 
836 
837  virtual DataType getOutputType(int index) const TRTNOEXCEPT = 0;
838 
846 
847  virtual bool outputTypeIsSet(int index) const TRTNOEXCEPT = 0;
848 
855 
856  virtual void resetOutputType(int index) TRTNOEXCEPT = 0;
857 
858 protected:
859  virtual ~ILayer() {}
860 };
861 
873 enum class PaddingMode : int
874 {
876  kEXPLICIT_ROUND_UP = 1,
877  kSAME_UPPER = 2,
878  kSAME_LOWER = 3,
879  kCAFFE_ROUND_DOWN = 4,
880  kCAFFE_ROUND_UP = 5
881 };
882 
883 template <>
884 constexpr inline int EnumMax<PaddingMode>()
885 {
886  return 6;
887 }
888 
901 class IConvolutionLayer : public ILayer
902 {
903 public:
911  virtual void setKernelSize(DimsHW kernelSize) TRTNOEXCEPT = 0;
912 
918  virtual DimsHW getKernelSize() const TRTNOEXCEPT = 0;
919 
927  virtual void setNbOutputMaps(int nbOutputMaps) TRTNOEXCEPT = 0;
928 
934  virtual int getNbOutputMaps() const TRTNOEXCEPT = 0;
935 
945  virtual void setStride(DimsHW stride) TRTNOEXCEPT = 0;
946 
950  virtual DimsHW getStride() const TRTNOEXCEPT = 0;
951 
964  virtual void setPadding(DimsHW padding) TRTNOEXCEPT = 0;
965 
971  virtual DimsHW getPadding() const TRTNOEXCEPT = 0;
972 
986  virtual void setNbGroups(int nbGroups) TRTNOEXCEPT = 0;
987 
993  virtual int getNbGroups() const TRTNOEXCEPT = 0;
994 
1004  virtual void setKernelWeights(Weights weights) TRTNOEXCEPT = 0;
1005 
1011  virtual Weights getKernelWeights() const TRTNOEXCEPT = 0;
1012 
1023  virtual void setBiasWeights(Weights weights) TRTNOEXCEPT = 0;
1024 
1030  virtual Weights getBiasWeights() const TRTNOEXCEPT = 0;
1031 
1039  virtual void setDilation(DimsHW dilation) TRTNOEXCEPT = 0;
1040 
1046  virtual DimsHW getDilation() const TRTNOEXCEPT = 0;
1047 
1048 protected:
1049  virtual ~IConvolutionLayer() {}
1050 
1051 public:
1063  virtual void setPrePadding(Dims padding) TRTNOEXCEPT = 0;
1064 
1070  virtual Dims getPrePadding() const TRTNOEXCEPT = 0;
1071 
1083  virtual void setPostPadding(Dims padding) TRTNOEXCEPT = 0;
1084 
1090  virtual Dims getPostPadding() const TRTNOEXCEPT = 0;
1091 
1101  virtual void setPaddingMode(PaddingMode paddingMode) TRTNOEXCEPT = 0;
1102 
1110  virtual PaddingMode getPaddingMode() const TRTNOEXCEPT = 0;
1111 
1119  virtual void setKernelSizeNd(Dims kernelSize) TRTNOEXCEPT = 0;
1120 
1126  virtual Dims getKernelSizeNd() const TRTNOEXCEPT = 0;
1127 
1137  virtual void setStrideNd(Dims stride) TRTNOEXCEPT = 0;
1138 
1144  virtual Dims getStrideNd() const TRTNOEXCEPT = 0;
1145 
1158  virtual void setPaddingNd(Dims padding) TRTNOEXCEPT = 0;
1159 
1167  virtual Dims getPaddingNd() const TRTNOEXCEPT = 0;
1168 
1176  virtual void setDilationNd(Dims dilation) TRTNOEXCEPT = 0;
1177 
1183  virtual Dims getDilationNd() const TRTNOEXCEPT = 0;
1184 };
1185 
1216 {
1217 public:
1225  virtual void setNbOutputChannels(int nbOutputs) TRTNOEXCEPT = 0;
1226 
1232  virtual int getNbOutputChannels() const TRTNOEXCEPT = 0;
1233 
1239  virtual void setKernelWeights(Weights weights) TRTNOEXCEPT = 0;
1240 
1246  virtual Weights getKernelWeights() const TRTNOEXCEPT = 0;
1247 
1255  virtual void setBiasWeights(Weights weights) TRTNOEXCEPT = 0;
1256 
1262  virtual Weights getBiasWeights() const TRTNOEXCEPT = 0;
1263 
1264 protected:
1265  virtual ~IFullyConnectedLayer() {}
1266 };
1267 
1279 class IActivationLayer : public ILayer
1280 {
1281 public:
1287  virtual void setActivationType(ActivationType type) TRTNOEXCEPT = 0;
1288 
1294  virtual ActivationType getActivationType() const TRTNOEXCEPT = 0;
1295 
1296 protected:
1297  virtual ~IActivationLayer() {}
1298 public:
1309  virtual void setAlpha(float alpha) TRTNOEXCEPT = 0;
1310 
1320  virtual void setBeta(float beta) TRTNOEXCEPT = 0;
1321 
1326  virtual float getAlpha() const TRTNOEXCEPT = 0;
1327 
1332  virtual float getBeta() const TRTNOEXCEPT = 0;
1333 };
1334 
1340 enum class PoolingType : int
1341 {
1342  kMAX = 0, // Maximum over elements
1343  kAVERAGE = 1, // Average over elements. If the tensor is padded, the count includes the padding
1344  kMAX_AVERAGE_BLEND = 2 // Blending between max and average pooling: (1-blendFactor)*maxPool + blendFactor*avgPool
1345 };
1346 
1347 template <>
1348 constexpr inline int EnumMax<PoolingType>()
1349 {
1350  return 3;
1351 }
1352 
1361 class IPoolingLayer : public ILayer
1362 {
1363 public:
1371  virtual void setPoolingType(PoolingType type) TRTNOEXCEPT = 0;
1372 
1378  virtual PoolingType getPoolingType() const TRTNOEXCEPT = 0;
1379 
1387  virtual void setWindowSize(DimsHW windowSize) TRTNOEXCEPT = 0;
1388 
1394  virtual DimsHW getWindowSize() const TRTNOEXCEPT = 0;
1395 
1405  virtual void setStride(DimsHW stride) TRTNOEXCEPT = 0;
1406 
1412  virtual DimsHW getStride() const TRTNOEXCEPT = 0;
1413 
1423  virtual void setPadding(DimsHW padding) TRTNOEXCEPT = 0;
1424 
1432  virtual DimsHW getPadding() const TRTNOEXCEPT = 0;
1433 
1442  virtual void setBlendFactor(float blendFactor) TRTNOEXCEPT = 0;
1443 
1452  virtual float getBlendFactor() const TRTNOEXCEPT = 0;
1453 
1463  virtual void setAverageCountExcludesPadding(bool exclusive) TRTNOEXCEPT = 0;
1464 
1471  virtual bool getAverageCountExcludesPadding() const TRTNOEXCEPT = 0;
1472 
1473 protected:
1474  virtual ~IPoolingLayer() {}
1475 
1476 public:
1488  virtual void setPrePadding(Dims padding) TRTNOEXCEPT = 0;
1489 
1495  virtual Dims getPrePadding() const TRTNOEXCEPT = 0;
1496 
1508  virtual void setPostPadding(Dims padding) TRTNOEXCEPT = 0;
1509 
1515  virtual Dims getPostPadding() const TRTNOEXCEPT = 0;
1516 
1525  virtual void setPaddingMode(PaddingMode paddingMode) TRTNOEXCEPT = 0;
1526 
1533  virtual PaddingMode getPaddingMode() const TRTNOEXCEPT = 0;
1534 
1542  virtual void setWindowSizeNd(Dims windowSize) TRTNOEXCEPT = 0;
1543 
1549  virtual Dims getWindowSizeNd() const TRTNOEXCEPT = 0;
1550 
1560  virtual void setStrideNd(Dims stride) TRTNOEXCEPT = 0;
1561 
1567  virtual Dims getStrideNd() const TRTNOEXCEPT = 0;
1568 
1581  virtual void setPaddingNd(Dims padding) TRTNOEXCEPT = 0;
1582 
1590  virtual Dims getPaddingNd() const TRTNOEXCEPT = 0;
1591 };
1592 
1602 class ILRNLayer : public ILayer
1603 {
1604 public:
1611  virtual void setWindowSize(int windowSize) TRTNOEXCEPT = 0;
1612 
1618  virtual int getWindowSize() const TRTNOEXCEPT = 0;
1619 
1626  virtual void setAlpha(float alpha) TRTNOEXCEPT = 0;
1627 
1633  virtual float getAlpha() const TRTNOEXCEPT = 0;
1634 
1641  virtual void setBeta(float beta) TRTNOEXCEPT = 0;
1642 
1648  virtual float getBeta() const TRTNOEXCEPT = 0;
1649 
1656  virtual void setK(float k) TRTNOEXCEPT = 0;
1657 
1663  virtual float getK() const TRTNOEXCEPT = 0;
1664 
1665 protected:
1666  virtual ~ILRNLayer() {}
1667 };
1668 
1674 enum class ScaleMode : int
1675 {
1676  kUNIFORM = 0,
1677  kCHANNEL = 1,
1678  kELEMENTWISE = 2
1679 };
1680 
1681 template <>
1682 constexpr inline int EnumMax<ScaleMode>()
1683 {
1684  return 3;
1685 }
1686 
1709 class IScaleLayer : public ILayer
1710 {
1711 public:
1717  virtual void setMode(ScaleMode mode) TRTNOEXCEPT = 0;
1718 
1724  virtual ScaleMode getMode() const TRTNOEXCEPT = 0;
1725 
1731  virtual void setShift(Weights shift) TRTNOEXCEPT = 0;
1732 
1738  virtual Weights getShift() const TRTNOEXCEPT = 0;
1739 
1745  virtual void setScale(Weights scale) TRTNOEXCEPT = 0;
1746 
1752  virtual Weights getScale() const TRTNOEXCEPT = 0;
1753 
1759  virtual void setPower(Weights power) TRTNOEXCEPT = 0;
1760 
1766  virtual Weights getPower() const TRTNOEXCEPT = 0;
1767 
1768 protected:
1769  virtual ~IScaleLayer() {}
1770 
1771 public:
1784  virtual int getChannelAxis() const TRTNOEXCEPT = 0;
1785 };
1786 
1798 class ISoftMaxLayer : public ILayer
1799 {
1800 protected:
1801  virtual ~ISoftMaxLayer() {}
1802 public:
1832  virtual void setAxes(uint32_t axes) TRTNOEXCEPT = 0;
1833 
1839  virtual uint32_t getAxes() const TRTNOEXCEPT = 0;
1840 };
1841 
1854 {
1855 protected:
1856  virtual ~IConcatenationLayer() {}
1857 
1858 public:
1867  virtual void setAxis(int axis) TRTNOEXCEPT = 0;
1868 
1874  virtual int getAxis() const TRTNOEXCEPT = 0;
1875 };
1876 
1887 {
1888 public:
1896  virtual void setKernelSize(DimsHW kernelSize) TRTNOEXCEPT = 0;
1897 
1903  virtual DimsHW getKernelSize() const TRTNOEXCEPT = 0;
1904 
1912  virtual void setNbOutputMaps(int nbOutputMaps) TRTNOEXCEPT = 0;
1913 
1919  virtual int getNbOutputMaps() const TRTNOEXCEPT = 0;
1920 
1928  virtual void setStride(DimsHW stride) TRTNOEXCEPT = 0;
1929 
1935  virtual DimsHW getStride() const TRTNOEXCEPT = 0;
1936 
1950  virtual void setPadding(DimsHW padding) TRTNOEXCEPT = 0;
1951 
1957  virtual DimsHW getPadding() const TRTNOEXCEPT = 0; // padding defaults to 0
1958 
1972  virtual void setNbGroups(int nbGroups) TRTNOEXCEPT = 0;
1973 
1979  virtual int getNbGroups() const TRTNOEXCEPT = 0;
1980 
1990  virtual void setKernelWeights(Weights weights) TRTNOEXCEPT = 0;
1991 
1997  virtual Weights getKernelWeights() const TRTNOEXCEPT = 0;
1998 
2009  virtual void setBiasWeights(Weights weights) TRTNOEXCEPT = 0;
2010 
2016  virtual Weights getBiasWeights() const TRTNOEXCEPT = 0;
2017 
2018 protected:
2019  virtual ~IDeconvolutionLayer() {}
2020 
2021 public:
2033  virtual void setPrePadding(Dims padding) TRTNOEXCEPT = 0;
2034 
2040  virtual Dims getPrePadding() const TRTNOEXCEPT = 0;
2041 
2053  virtual void setPostPadding(Dims padding) TRTNOEXCEPT = 0;
2054 
2060  virtual Dims getPostPadding() const TRTNOEXCEPT = 0;
2061 
2070  virtual void setPaddingMode(PaddingMode paddingMode) TRTNOEXCEPT = 0;
2071 
2078  virtual PaddingMode getPaddingMode() const TRTNOEXCEPT = 0;
2079 
2087  virtual void setKernelSizeNd(Dims kernelSize) TRTNOEXCEPT = 0;
2088 
2094  virtual Dims getKernelSizeNd() const TRTNOEXCEPT = 0;
2095 
2105  virtual void setStrideNd(Dims stride) TRTNOEXCEPT = 0;
2106 
2112  virtual Dims getStrideNd() const TRTNOEXCEPT = 0;
2113 
2126  virtual void setPaddingNd(Dims padding) TRTNOEXCEPT = 0;
2127 
2135  virtual Dims getPaddingNd() const TRTNOEXCEPT = 0;
2136 };
2137 
2145 enum class ElementWiseOperation : int
2146 {
2147  kSUM = 0,
2148  kPROD = 1,
2149  kMAX = 2,
2150  kMIN = 3,
2151  kSUB = 4,
2152  kDIV = 5,
2153  kPOW = 6,
2154  kFLOOR_DIV = 7
2155 };
2156 
2157 template <>
2158 constexpr inline int EnumMax<ElementWiseOperation>()
2159 {
2160  return 8;
2161 }
2162 
2175 {
2176 public:
2186  virtual void setOperation(ElementWiseOperation type) TRTNOEXCEPT = 0;
2187 
2195  virtual ElementWiseOperation getOperation() const TRTNOEXCEPT = 0;
2196 
2197 protected:
2198  virtual ~IElementWiseLayer() {}
2199 };
2200 
2204 class IGatherLayer : public ILayer
2205 {
2206 public:
2213  virtual void setGatherAxis(int axis) TRTNOEXCEPT = 0;
2214 
2220  virtual int getGatherAxis() const TRTNOEXCEPT = 0;
2221 
2228  virtual void setNbElementWiseDims(int k) TRTNOEXCEPT = 0;
2229 
2235  virtual int getNbElementWiseDims() const TRTNOEXCEPT = 0;
2236 
2237 protected:
2238  virtual ~IGatherLayer() {}
2239 };
2240 
2320 enum class RNNOperation : int
2321 {
2322  kRELU = 0,
2323  kTANH = 1,
2324  kLSTM = 2,
2325  kGRU = 3
2326 };
2327 
2328 template <>
2329 constexpr inline int EnumMax<RNNOperation>()
2330 {
2331  return 4;
2332 }
2333 
2341 enum class RNNDirection : int
2342 {
2343  kUNIDIRECTION = 0,
2344  kBIDIRECTION = 1
2345 };
2346 
2347 template <>
2348 constexpr inline int EnumMax<RNNDirection>()
2349 {
2350  return 2;
2351 }
2352 
2368 enum class RNNInputMode : int
2369 {
2370  kLINEAR = 0,
2371  kSKIP = 1
2372 };
2373 
2374 template <>
2375 constexpr inline int EnumMax<RNNInputMode>()
2376 {
2377  return 2;
2378 }
2379 
2391 class TRT_DEPRECATED IRNNLayer : public ILayer
2392 {
2393 public:
2399  virtual unsigned getLayerCount() const TRTNOEXCEPT = 0;
2400 
2409  virtual std::size_t getHiddenSize() const TRTNOEXCEPT = 0;
2410 
2419  virtual int getSeqLength() const TRTNOEXCEPT = 0;
2420 
2426  virtual void setOperation(RNNOperation op) TRTNOEXCEPT = 0;
2427 
2433  virtual RNNOperation getOperation() const TRTNOEXCEPT = 0;
2434 
2440  virtual void setInputMode(RNNInputMode op) TRTNOEXCEPT = 0;
2441 
2447  virtual RNNInputMode getInputMode() const TRTNOEXCEPT = 0;
2448 
2460  virtual void setDirection(RNNDirection op) TRTNOEXCEPT = 0;
2461 
2467  virtual RNNDirection getDirection() const TRTNOEXCEPT = 0;
2468 
2583  virtual void setWeights(Weights weights) TRTNOEXCEPT = 0;
2584 
2590  virtual Weights getWeights() const TRTNOEXCEPT = 0;
2591 
2643  virtual void setBias(Weights bias) TRTNOEXCEPT = 0;
2644 
2650  virtual Weights getBias() const TRTNOEXCEPT = 0;
2651 
2658  virtual int getDataLength() const TRTNOEXCEPT = 0;
2659 
2677  virtual void setHiddenState(ITensor& hidden) TRTNOEXCEPT = 0;
2678 
2684  virtual ITensor* getHiddenState() const TRTNOEXCEPT = 0;
2685 
2705  virtual void setCellState(ITensor& cell) TRTNOEXCEPT = 0;
2706 
2712  virtual ITensor* getCellState() const TRTNOEXCEPT = 0;
2713 
2714 protected:
2715  virtual ~IRNNLayer() {}
2716 };
2717 
2725 enum class RNNGateType : int
2726 {
2727  kINPUT = 0,
2728  kOUTPUT = 1,
2729  kFORGET = 2,
2730  kUPDATE = 3,
2731  kRESET = 4,
2732  kCELL = 5,
2733  kHIDDEN = 6
2734 };
2735 
2736 template <>
2737 constexpr inline int EnumMax<RNNGateType>()
2738 {
2739  return 7;
2740 }
2741 
2751 class IRNNv2Layer : public ILayer
2752 {
2753 public:
2754  virtual int32_t getLayerCount() const TRTNOEXCEPT = 0; //< Get the layer count of the RNN
2755  virtual int32_t getHiddenSize() const TRTNOEXCEPT = 0; //< Get the hidden size of the RNN
2756  virtual int32_t getMaxSeqLength() const TRTNOEXCEPT = 0; //< Get the maximum sequence length of the RNN
2757  virtual int32_t getDataLength() const TRTNOEXCEPT = 0; //< Get the maximum data length of the RNN
2758 
2773  virtual void setSequenceLengths(ITensor& seqLengths) TRTNOEXCEPT = 0;
2774 
2782  virtual ITensor* getSequenceLengths() const TRTNOEXCEPT = 0;
2783 
2788  virtual void setOperation(RNNOperation op) TRTNOEXCEPT = 0;
2789 
2794  virtual RNNOperation getOperation() const TRTNOEXCEPT = 0;
2795 
2800  virtual void setInputMode(RNNInputMode op) TRTNOEXCEPT = 0;
2801 
2806  virtual RNNInputMode getInputMode() const TRTNOEXCEPT = 0;
2807 
2812  virtual void setDirection(RNNDirection op) TRTNOEXCEPT = 0;
2813 
2818  virtual RNNDirection getDirection() const TRTNOEXCEPT = 0;
2819 
2837  virtual void setWeightsForGate(int layerIndex, RNNGateType gate, bool isW, Weights weights) TRTNOEXCEPT = 0;
2838 
2843  virtual Weights getWeightsForGate(int layerIndex, RNNGateType gate, bool isW) const TRTNOEXCEPT = 0;
2844 
2860  virtual void setBiasForGate(int layerIndex, RNNGateType gate, bool isW, Weights bias) TRTNOEXCEPT = 0;
2861 
2866  virtual Weights getBiasForGate(int layerIndex, RNNGateType gate, bool isW) const TRTNOEXCEPT = 0;
2867 
2880  virtual void setHiddenState(ITensor& hidden) TRTNOEXCEPT = 0;
2881 
2886  virtual ITensor* getHiddenState() const TRTNOEXCEPT = 0;
2887 
2902  virtual void setCellState(ITensor& cell) TRTNOEXCEPT = 0;
2903 
2908  virtual ITensor* getCellState() const TRTNOEXCEPT = 0;
2909 
2910 protected:
2911  virtual ~IRNNv2Layer() {}
2912 };
2913 
2920 {
2921 public:
2937  virtual DimsHW compute(DimsHW inputDims, DimsHW kernelSize, DimsHW stride, DimsHW padding, DimsHW dilation, const char* layerName) const TRTNOEXCEPT = 0;
2938 
2939  virtual ~IOutputDimensionsFormula() {}
2940 };
2941 
2953 class TRT_DEPRECATED IPluginLayer : public ILayer
2954 {
2955 public:
2961  virtual IPlugin& getPlugin() TRTNOEXCEPT = 0;
2962 
2963 protected:
2964  virtual ~IPluginLayer() {}
2965 };
2966 
2976 class IPluginV2Layer : public ILayer
2977 {
2978 public:
2984  virtual IPluginV2& getPlugin() TRTNOEXCEPT = 0;
2985 
2986 protected:
2987  virtual ~IPluginV2Layer() {}
2988 };
2989 
2997 enum class UnaryOperation : int
2998 {
2999  kEXP = 0,
3000  kLOG = 1,
3001  kSQRT = 2,
3002  kRECIP = 3,
3003  kABS = 4,
3004  kNEG = 5,
3005  kSIN = 6,
3006  kCOS = 7,
3007  kTAN = 8,
3008  kSINH = 9,
3009  kCOSH = 10,
3010  kASIN = 11,
3011  kACOS = 12,
3012  kATAN = 13,
3013  kASINH = 14,
3014  kACOSH = 15,
3015  kATANH = 16,
3016  kCEIL = 17,
3017  kFLOOR = 18
3018 };
3019 
3020 template <>
3021 constexpr inline int EnumMax<UnaryOperation>()
3022 {
3023  return 19;
3024 }
3025 
3033 class IUnaryLayer : public ILayer
3034 {
3035 public:
3041  virtual void setOperation(UnaryOperation op) TRTNOEXCEPT = 0;
3042 
3048  virtual UnaryOperation getOperation() const TRTNOEXCEPT = 0;
3049 
3050 protected:
3051  virtual ~IUnaryLayer() {}
3052 };
3053 
3059 enum class ReduceOperation : int
3060 {
3061  kSUM = 0,
3062  kPROD = 1,
3063  kMAX = 2,
3064  kMIN = 3,
3065  kAVG = 4
3066 };
3067 
3068 template <>
3069 constexpr inline int EnumMax<ReduceOperation>()
3070 {
3071  return 5;
3072 }
3073 
3081 class IReduceLayer : public ILayer
3082 {
3083 public:
3089  virtual void setOperation(ReduceOperation op) TRTNOEXCEPT = 0;
3090 
3096  virtual ReduceOperation getOperation() const TRTNOEXCEPT = 0;
3097 
3103  virtual void setReduceAxes(uint32_t reduceAxes) TRTNOEXCEPT = 0;
3104 
3110  virtual uint32_t getReduceAxes() const TRTNOEXCEPT = 0;
3111 
3117  virtual void setKeepDimensions(bool keepDimensions) TRTNOEXCEPT = 0;
3118 
3124  virtual bool getKeepDimensions() const TRTNOEXCEPT = 0;
3125 
3126 protected:
3127  virtual ~IReduceLayer() {}
3128 };
3129 
3140 class IPaddingLayer : public ILayer
3141 {
3142 public:
3150  virtual void setPrePadding(DimsHW padding) TRTNOEXCEPT = 0;
3151 
3157  virtual DimsHW getPrePadding() const TRTNOEXCEPT = 0;
3158 
3166  virtual void setPostPadding(DimsHW padding) TRTNOEXCEPT = 0;
3167 
3173  virtual DimsHW getPostPadding() const TRTNOEXCEPT = 0;
3174 
3175 protected:
3176  virtual ~IPaddingLayer() {}
3177 };
3178 
3180 {
3187  int order[Dims::MAX_DIMS];
3188 };
3189 
3202 class IShuffleLayer : public ILayer
3203 {
3204 public:
3214  virtual void setFirstTranspose(Permutation permutation) TRTNOEXCEPT = 0;
3215 
3223  virtual Permutation getFirstTranspose() const TRTNOEXCEPT = 0;
3224 
3247  virtual void setReshapeDimensions(Dims dimensions) TRTNOEXCEPT = 0;
3248 
3256  virtual Dims getReshapeDimensions() const TRTNOEXCEPT = 0;
3257 
3267  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
3268 
3281  virtual void setSecondTranspose(Permutation permutation) TRTNOEXCEPT = 0;
3282 
3290  virtual Permutation getSecondTranspose() const TRTNOEXCEPT = 0;
3291 
3292 protected:
3293  virtual ~IShuffleLayer() {}
3294 };
3295 
3320 class ISliceLayer : public ILayer
3321 {
3322 public:
3333  virtual void setStart(Dims start) TRTNOEXCEPT = 0;
3334 
3345  virtual Dims getStart() const TRTNOEXCEPT = 0;
3346 
3357  virtual void setSize(Dims size) TRTNOEXCEPT = 0;
3358 
3369  virtual Dims getSize() const TRTNOEXCEPT = 0;
3370 
3381  virtual void setStride(Dims stride) TRTNOEXCEPT = 0;
3382 
3393  virtual Dims getStride() const TRTNOEXCEPT = 0;
3394 
3422  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
3423 
3424 protected:
3425  virtual ~ISliceLayer() {}
3426 };
3427 
3440 class IShapeLayer : public ILayer
3441 {
3442 protected:
3443  virtual ~IShapeLayer() {}
3444 };
3445 
3451 enum class TopKOperation : int
3452 {
3453  kMAX = 0,
3454  kMIN = 1,
3455 };
3456 
3457 template <>
3458 constexpr inline int EnumMax<TopKOperation>()
3459 {
3460  return 2;
3461 }
3462 
3470 class ITopKLayer : public ILayer
3471 {
3472 public:
3478  virtual void setOperation(TopKOperation op) TRTNOEXCEPT = 0;
3479 
3485  virtual TopKOperation getOperation() const TRTNOEXCEPT = 0;
3486 
3494  virtual void setK(int k) TRTNOEXCEPT = 0;
3495 
3501  virtual int getK() const TRTNOEXCEPT = 0;
3502 
3508  virtual void setReduceAxes(uint32_t reduceAxes) TRTNOEXCEPT = 0;
3509 
3515  virtual uint32_t getReduceAxes() const TRTNOEXCEPT = 0;
3516 
3517 protected:
3518  virtual ~ITopKLayer() {}
3519 };
3520 
3527 enum class MatrixOperation : int
3528 {
3532  kNONE,
3533 
3535  kTRANSPOSE,
3536 
3546  kVECTOR
3547 };
3548 
3549 template <>
3550 constexpr inline int EnumMax<MatrixOperation>()
3551 {
3552  return 3;
3553 }
3554 
3581 {
3582 public:
3589  virtual void setOperation(int index, MatrixOperation op) TRTNOEXCEPT = 0;
3590 
3596  virtual MatrixOperation getOperation(int index) const TRTNOEXCEPT = 0;
3597 
3606  TRT_DEPRECATED virtual void setTranspose(int index, bool val) TRTNOEXCEPT = 0;
3607 
3615  TRT_DEPRECATED virtual bool getTranspose(int index) const TRTNOEXCEPT = 0;
3616 
3617 protected:
3618  virtual ~IMatrixMultiplyLayer() {}
3619 };
3620 
3636 {
3637 protected:
3638  virtual ~IRaggedSoftMaxLayer() {}
3639 };
3640 
3649 class IIdentityLayer : public ILayer
3650 {
3651 protected:
3652  virtual ~IIdentityLayer() {}
3653 };
3654 
3661 class IConstantLayer : public ILayer
3662 {
3663 public:
3673  virtual void setWeights(Weights weights) TRTNOEXCEPT = 0;
3674 
3680  virtual Weights getWeights() const TRTNOEXCEPT = 0;
3681 
3689  virtual void setDimensions(Dims dimensions) TRTNOEXCEPT = 0;
3690 
3698  virtual Dims getDimensions() const TRTNOEXCEPT = 0;
3699 
3700 protected:
3701  virtual ~IConstantLayer() {}
3702 };
3703 
3712 {
3713 protected:
3714  virtual ~IParametricReLULayer() noexcept {}
3715 };
3716 
3722 enum class ResizeMode : int
3723 {
3724  kNEAREST = 0, // N-D (0 < N <= 8) nearest neighbor resizing.
3725  kLINEAR = 1 // Can handle linear (1D), bilinear (2D), and trilinear (3D) resizing.
3726 };
3727 
3728 template <>
3729 constexpr inline int EnumMax<ResizeMode>()
3730 {
3731  return 2;
3732 }
3733 
3754 class IResizeLayer : public ILayer
3755 {
3756 public:
3772  virtual void setOutputDimensions(Dims dimensions) TRTNOEXCEPT = 0;
3773 
3779  virtual Dims getOutputDimensions() const TRTNOEXCEPT = 0;
3780 
3799  virtual void setScales(const float* scales, int nbScales) TRTNOEXCEPT = 0;
3800 
3815  virtual int getScales(int size, float* scales) const TRTNOEXCEPT = 0;
3816 
3824  virtual void setResizeMode(ResizeMode resizeMode) TRTNOEXCEPT = 0;
3825 
3831  virtual ResizeMode getResizeMode() const TRTNOEXCEPT = 0;
3832 
3842  virtual void setAlignCorners(bool alignCorners) TRTNOEXCEPT = 0;
3843 
3849  virtual bool getAlignCorners() const TRTNOEXCEPT = 0;
3850 
3866  void setInput(int index, ITensor& tensor) _TENSORRT_OVERRIDE TRTNOEXCEPT = 0;
3867 
3868 protected:
3869  virtual ~IResizeLayer() {}
3870 };
3871 
3892 {
3893 public:
3899 
3920  virtual ITensor* addInput(const char* name, DataType type, Dims dimensions) TRTNOEXCEPT = 0;
3921 
3929  virtual void markOutput(ITensor& tensor) TRTNOEXCEPT = 0;
3930 
3947  virtual IConvolutionLayer* addConvolution(ITensor& input, int nbOutputMaps, DimsHW kernelSize,
3948  Weights kernelWeights, Weights biasWeights) TRTNOEXCEPT = 0;
3949 
3965  virtual IFullyConnectedLayer* addFullyConnected(
3966  ITensor& input, int nbOutputs, Weights kernelWeights, Weights biasWeights) TRTNOEXCEPT = 0;
3967 
3982  virtual IActivationLayer* addActivation(ITensor& input, ActivationType type) TRTNOEXCEPT = 0;
3983 
3996  virtual IPoolingLayer* addPooling(ITensor& input, PoolingType type, DimsHW windowSize) TRTNOEXCEPT = 0;
3997 
4012  virtual ILRNLayer* addLRN(ITensor& input, int window, float alpha, float beta, float k) TRTNOEXCEPT = 0;
4013 
4033  virtual IScaleLayer* addScale(ITensor& input, ScaleMode mode, Weights shift, Weights scale, Weights power) TRTNOEXCEPT = 0;
4034 
4043  virtual ISoftMaxLayer* addSoftMax(ITensor& input) TRTNOEXCEPT = 0;
4044 
4057  virtual IConcatenationLayer* addConcatenation(ITensor* const* inputs, int nbInputs) TRTNOEXCEPT = 0;
4058 
4075  virtual IDeconvolutionLayer* addDeconvolution(ITensor& input, int nbOutputMaps, DimsHW kernelSize,
4076  Weights kernelWeights, Weights biasWeights) TRTNOEXCEPT = 0;
4077 
4098  virtual IElementWiseLayer* addElementWise(ITensor& input1, ITensor& input2, ElementWiseOperation op) TRTNOEXCEPT = 0;
4099 
4158  TRT_DEPRECATED virtual IRNNLayer* addRNN(ITensor& inputs, int layerCount, std::size_t hiddenSize, int maxSeqLen,
4159  RNNOperation op, RNNInputMode mode, RNNDirection dir, Weights weights, Weights bias) TRTNOEXCEPT = 0;
4160 
4177  TRT_DEPRECATED virtual IPluginLayer* addPlugin(
4178  ITensor* const* inputs, int nbInputs, IPlugin& plugin) TRTNOEXCEPT = 0;
4179 
4192  virtual IUnaryLayer* addUnary(ITensor& input, UnaryOperation operation) TRTNOEXCEPT = 0;
4193 
4204  virtual IPaddingLayer* addPadding(ITensor& input, DimsHW prePadding, DimsHW postPadding) TRTNOEXCEPT = 0;
4205 
4215  virtual IShuffleLayer* addShuffle(ITensor& input) TRTNOEXCEPT = 0;
4216 
4229  TRT_DEPRECATED virtual void setPoolingOutputDimensionsFormula(IOutputDimensionsFormula* formula) TRTNOEXCEPT = 0;
4230 
4240  TRT_DEPRECATED virtual IOutputDimensionsFormula& getPoolingOutputDimensionsFormula() const TRTNOEXCEPT = 0;
4241 
4256  TRT_DEPRECATED virtual void setConvolutionOutputDimensionsFormula(
4257  IOutputDimensionsFormula* formula) TRTNOEXCEPT = 0;
4258 
4270  TRT_DEPRECATED virtual IOutputDimensionsFormula& getConvolutionOutputDimensionsFormula() const TRTNOEXCEPT = 0;
4271 
4286  TRT_DEPRECATED virtual void setDeconvolutionOutputDimensionsFormula(
4287  IOutputDimensionsFormula* formula) TRTNOEXCEPT = 0;
4288 
4300  TRT_DEPRECATED virtual IOutputDimensionsFormula& getDeconvolutionOutputDimensionsFormula() const TRTNOEXCEPT = 0;
4301 
4309  virtual int getNbLayers() const TRTNOEXCEPT = 0;
4310 
4320  virtual ILayer* getLayer(int index) const TRTNOEXCEPT = 0;
4321 
4329  virtual int getNbInputs() const TRTNOEXCEPT = 0;
4330 
4340  virtual ITensor* getInput(int index) const TRTNOEXCEPT = 0; // adding inputs invalidates indexing here
4341 
4351  virtual int getNbOutputs() const TRTNOEXCEPT = 0;
4352 
4362  virtual ITensor* getOutput(int index) const TRTNOEXCEPT = 0; // adding outputs invalidates indexing here
4363 
4367  virtual void destroy() TRTNOEXCEPT = 0;
4368 
4369 protected:
4370  virtual ~INetworkDefinition() {}
4371 
4372 public:
4392  virtual IReduceLayer* addReduce(ITensor& input, ReduceOperation operation, uint32_t reduceAxes, bool keepDimensions) TRTNOEXCEPT = 0;
4393 
4422  virtual ITopKLayer* addTopK(ITensor& input, TopKOperation op, int k, uint32_t reduceAxes) TRTNOEXCEPT = 0;
4423 
4435  virtual IGatherLayer* addGather(ITensor& data, ITensor& indices, int axis) TRTNOEXCEPT = 0;
4436 
4450  virtual IRaggedSoftMaxLayer* addRaggedSoftMax(ITensor& input, ITensor& bounds) TRTNOEXCEPT = 0;
4451 
4466  virtual IMatrixMultiplyLayer* addMatrixMultiply(
4467  ITensor& input0, MatrixOperation op0, ITensor& input1, MatrixOperation op1) TRTNOEXCEPT = 0;
4468 
4485  TRT_DEPRECATED virtual IMatrixMultiplyLayer* addMatrixMultiply(
4486  ITensor& input0, bool transpose0, ITensor& input1, bool transpose1) TRTNOEXCEPT = 0;
4487 
4508  virtual IConstantLayer* addConstant(Dims dimensions, Weights weights) TRTNOEXCEPT = 0;
4509 
4571  virtual IRNNv2Layer* addRNNv2(
4572  ITensor& input, int32_t layerCount, int32_t hiddenSize, int32_t maxSeqLen, RNNOperation op) TRTNOEXCEPT = 0;
4573 
4590  TRT_DEPRECATED virtual IPluginLayer* addPluginExt(
4591  ITensor* const* inputs, int nbInputs, IPluginExt& plugin) TRTNOEXCEPT = 0;
4592 
4604  virtual IIdentityLayer* addIdentity(ITensor& input) TRTNOEXCEPT = 0;
4605 
4616  virtual void removeTensor(ITensor& tensor) TRTNOEXCEPT = 0;
4617 
4625  virtual void unmarkOutput(ITensor& tensor) TRTNOEXCEPT = 0;
4626 
4641  virtual IPluginV2Layer* addPluginV2(ITensor* const* inputs, int nbInputs, IPluginV2& plugin) TRTNOEXCEPT = 0;
4642 
4657  virtual ISliceLayer* addSlice(ITensor& input, Dims start, Dims size, Dims stride) TRTNOEXCEPT = 0;
4658 
4676  virtual void setName(const char* name) TRTNOEXCEPT = 0;
4677 
4687  virtual const char* getName() const TRTNOEXCEPT = 0;
4688 
4702  virtual IShapeLayer* addShape(ITensor& input) TRTNOEXCEPT = 0;
4703 
4718  virtual bool hasImplicitBatchDimension() const TRTNOEXCEPT = 0;
4719 
4733  virtual bool markOutputForShapes(ITensor& tensor) TRTNOEXCEPT = 0;
4734 
4742  virtual bool unmarkOutputForShapes(ITensor& tensor) TRTNOEXCEPT = 0;
4743 
4757  virtual IParametricReLULayer* addParametricReLU(ITensor& input, ITensor& slope) noexcept = 0;
4758 
4776  virtual IConvolutionLayer* addConvolutionNd(
4777  ITensor& input, int nbOutputMaps, Dims kernelSize, Weights kernelWeights, Weights biasWeights) TRTNOEXCEPT = 0;
4778 
4793  virtual IPoolingLayer* addPoolingNd(ITensor& input, PoolingType type, Dims windowSize) TRTNOEXCEPT = 0;
4794 
4809  //
4812  virtual IDeconvolutionLayer* addDeconvolutionNd(
4813  ITensor& input, int nbOutputMaps, Dims kernelSize, Weights kernelWeights, Weights biasWeights) TRTNOEXCEPT = 0;
4814 
4836  virtual IScaleLayer* addScaleNd(ITensor& input, ScaleMode mode, Weights shift, Weights scale, Weights power, int channelAxis) TRTNOEXCEPT = 0;
4837 
4848  virtual IResizeLayer* addResize(ITensor& input) TRTNOEXCEPT = 0;
4849 
4860  virtual bool hasExplicitPrecision() const TRTNOEXCEPT = 0;
4861 };
4862 
4868 enum class CalibrationAlgoType : int
4869 {
4870  kLEGACY_CALIBRATION = 0,
4871  kENTROPY_CALIBRATION = 1,
4872  kENTROPY_CALIBRATION_2 = 2,
4873  kMINMAX_CALIBRATION = 3,
4874 };
4875 
4876 template <>
4877 constexpr inline int EnumMax<CalibrationAlgoType>()
4878 {
4879  return 4;
4880 }
4881 
4894 {
4895 public:
4901  virtual int getBatchSize() const TRTNOEXCEPT = 0;
4902 
4916  virtual bool getBatch(void* bindings[], const char* names[], int nbBindings) TRTNOEXCEPT = 0;
4917 
4932  virtual const void* readCalibrationCache(std::size_t& length) TRTNOEXCEPT = 0;
4933 
4942  virtual void writeCalibrationCache(const void* ptr, std::size_t length) TRTNOEXCEPT = 0;
4943 
4949  virtual CalibrationAlgoType getAlgorithm() TRTNOEXCEPT = 0;
4950 
4951  virtual ~IInt8Calibrator() {}
4952 };
4953 
4959 {
4960 public:
4964  CalibrationAlgoType getAlgorithm() TRTNOEXCEPT override { return CalibrationAlgoType::kENTROPY_CALIBRATION; }
4965 
4966  virtual ~IInt8EntropyCalibrator() {}
4967 };
4968 
4974 {
4975 public:
4979  CalibrationAlgoType getAlgorithm() TRTNOEXCEPT override { return CalibrationAlgoType::kENTROPY_CALIBRATION_2; }
4980 
4981  virtual ~IInt8EntropyCalibrator2() {}
4982 };
4983 
4989 {
4990 public:
4994  CalibrationAlgoType getAlgorithm() TRTNOEXCEPT override { return CalibrationAlgoType::kMINMAX_CALIBRATION; }
4995 
4996  virtual ~IInt8MinMaxCalibrator() {}
4997 };
4998 
5002 class TRT_DEPRECATED IInt8LegacyCalibrator : public IInt8Calibrator
5003 {
5004 public:
5008  CalibrationAlgoType getAlgorithm() TRTNOEXCEPT override { return CalibrationAlgoType::kLEGACY_CALIBRATION; }
5009 
5016  virtual double getQuantile() const TRTNOEXCEPT = 0;
5017 
5024  virtual double getRegressionCutoff() const TRTNOEXCEPT = 0;
5025 
5038  virtual const void* readHistogramCache(std::size_t& length) TRTNOEXCEPT = 0;
5039 
5048  virtual void writeHistogramCache(const void* ptr, std::size_t length) TRTNOEXCEPT = 0;
5049 
5050  virtual ~IInt8LegacyCalibrator() {}
5051 };
5052 
5059 typedef uint32_t BuilderFlags;
5060 
5068 enum class BuilderFlag : int
5069 {
5070  kFP16 = 0,
5071  kINT8 = 1,
5072  kDEBUG = 2,
5073  kGPU_FALLBACK = 3,
5074  kSTRICT_TYPES = 4,
5075  kREFIT = 5,
5076 };
5077 
5078 template <>
5079 constexpr inline int EnumMax<BuilderFlag>()
5080 {
5081  return 6;
5082 }
5083 
5090 {
5091 public:
5102  virtual void setMinTimingIterations(int minTiming) TRTNOEXCEPT = 0;
5103 
5111  virtual int getMinTimingIterations() const TRTNOEXCEPT = 0;
5112 
5121  virtual void setAvgTimingIterations(int avgTiming) TRTNOEXCEPT = 0;
5122 
5130  virtual int getAvgTimingIterations() const TRTNOEXCEPT = 0;
5131 
5140  virtual void setEngineCapability(EngineCapability capability) TRTNOEXCEPT = 0;
5141 
5149  virtual EngineCapability getEngineCapability() const TRTNOEXCEPT = 0;
5150 
5156  virtual void setInt8Calibrator(IInt8Calibrator* calibrator) TRTNOEXCEPT = 0;
5157 
5161  virtual IInt8Calibrator* getInt8Calibrator() const TRTNOEXCEPT = 0;
5162 
5170  virtual void setMaxWorkspaceSize(std::size_t workspaceSize) TRTNOEXCEPT = 0;
5171 
5181  virtual std::size_t getMaxWorkspaceSize() const TRTNOEXCEPT = 0;
5182 
5195  virtual void setFlags(BuilderFlags builderFlags) TRTNOEXCEPT = 0;
5196 
5204  virtual BuilderFlags getFlags() const TRTNOEXCEPT = 0;
5205 
5213  virtual void clearFlag(BuilderFlag builderFlag) TRTNOEXCEPT = 0;
5214 
5222  virtual void setFlag(BuilderFlag builderFlag) TRTNOEXCEPT = 0;
5223 
5233  virtual bool getFlag(BuilderFlag builderFlag) const TRTNOEXCEPT = 0;
5234 
5235 
5246  virtual void setDeviceType(const ILayer* layer, DeviceType deviceType) TRTNOEXCEPT = 0;
5247 
5252  virtual DeviceType getDeviceType(const ILayer* layer) const TRTNOEXCEPT = 0;
5253 
5259  virtual bool isDeviceTypeSet(const ILayer* layer) const TRTNOEXCEPT = 0;
5260 
5266  virtual void resetDeviceType(const ILayer* layer) TRTNOEXCEPT = 0;
5267 
5272  virtual bool canRunOnDLA(const ILayer* layer) const TRTNOEXCEPT = 0;
5273 
5282  virtual void setDLACore(int dlaCore) TRTNOEXCEPT = 0;
5283 
5288  virtual int getDLACore() const TRTNOEXCEPT = 0;
5289 
5295  virtual void setDefaultDeviceType(DeviceType deviceType) TRTNOEXCEPT = 0;
5296 
5302  virtual DeviceType getDefaultDeviceType() const TRTNOEXCEPT = 0;
5303 
5309  virtual void reset() TRTNOEXCEPT = 0;
5310 
5316  virtual void destroy() TRTNOEXCEPT = 0;
5317 
5325  virtual void setProfileStream(const cudaStream_t stream) TRTNOEXCEPT = 0;
5326 
5334  virtual cudaStream_t getProfileStream() const TRTNOEXCEPT = 0;
5335 
5347  virtual int addOptimizationProfile(const IOptimizationProfile* profile) noexcept = 0;
5348 
5355  virtual int getNbOptimizationProfiles() const noexcept = 0;
5356 
5357 protected:
5358  virtual ~IBuilderConfig()
5359  {
5360  }
5361 };
5362 
5372 
5383 {
5388  kEXPLICIT_BATCH = 0,
5389 
5402  kEXPLICIT_PRECISION = 1,
5403 };
5404 template <>
5405 constexpr inline int EnumMax<NetworkDefinitionCreationFlag>()
5406 {
5407  return 2;
5408 }
5409 
5418 {
5419 public:
5431  TRT_DEPRECATED virtual nvinfer1::INetworkDefinition* createNetwork() TRTNOEXCEPT = 0;
5432 
5441  virtual void setMaxBatchSize(int batchSize) TRTNOEXCEPT = 0;
5442 
5451  virtual int getMaxBatchSize() const TRTNOEXCEPT = 0;
5452 
5462  TRT_DEPRECATED virtual void setMaxWorkspaceSize(std::size_t workspaceSize) TRTNOEXCEPT = 0;
5463 
5473  TRT_DEPRECATED virtual std::size_t getMaxWorkspaceSize() const TRTNOEXCEPT = 0;
5474 
5487  TRT_DEPRECATED virtual void setHalf2Mode(bool mode) TRTNOEXCEPT = 0;
5488 
5496  TRT_DEPRECATED virtual bool getHalf2Mode() const TRTNOEXCEPT = 0;
5497 
5506  TRT_DEPRECATED virtual void setDebugSync(bool sync) TRTNOEXCEPT = 0;
5507 
5515  TRT_DEPRECATED virtual bool getDebugSync() const TRTNOEXCEPT = 0;
5516 
5527  TRT_DEPRECATED virtual void setMinFindIterations(int minFind) TRTNOEXCEPT = 0;
5528 
5536  TRT_DEPRECATED virtual int getMinFindIterations() const TRTNOEXCEPT = 0;
5537 
5548  TRT_DEPRECATED virtual void setAverageFindIterations(int avgFind) TRTNOEXCEPT = 0;
5549 
5557  TRT_DEPRECATED virtual int getAverageFindIterations() const TRTNOEXCEPT = 0;
5558 
5566  TRT_DEPRECATED virtual nvinfer1::ICudaEngine* buildCudaEngine(
5567  nvinfer1::INetworkDefinition& network) TRTNOEXCEPT = 0;
5568 
5572  virtual bool platformHasFastFp16() const TRTNOEXCEPT = 0;
5573 
5577  virtual bool platformHasFastInt8() const TRTNOEXCEPT = 0;
5578 
5582  virtual void destroy() TRTNOEXCEPT = 0;
5583 
5595  TRT_DEPRECATED virtual void setInt8Mode(bool mode) TRTNOEXCEPT = 0;
5596 
5604  TRT_DEPRECATED virtual bool getInt8Mode() const TRTNOEXCEPT = 0;
5605 
5611  TRT_DEPRECATED virtual void setInt8Calibrator(IInt8Calibrator* calibrator) TRTNOEXCEPT = 0;
5612 
5625  TRT_DEPRECATED virtual void setDeviceType(ILayer* layer, DeviceType deviceType) TRTNOEXCEPT = 0;
5626 
5633  TRT_DEPRECATED virtual DeviceType getDeviceType(const ILayer* layer) const TRTNOEXCEPT = 0;
5634 
5642  TRT_DEPRECATED virtual bool isDeviceTypeSet(const ILayer* layer) const TRTNOEXCEPT = 0;
5643 
5651  TRT_DEPRECATED virtual void resetDeviceType(ILayer* layer) TRTNOEXCEPT = 0;
5652 
5657  TRT_DEPRECATED virtual bool canRunOnDLA(const ILayer* layer) const TRTNOEXCEPT = 0;
5658 
5666  TRT_DEPRECATED virtual void setDefaultDeviceType(DeviceType deviceType) TRTNOEXCEPT = 0;
5667 
5673  TRT_DEPRECATED virtual DeviceType getDefaultDeviceType() const TRTNOEXCEPT = 0;
5674 
5682  virtual int getMaxDLABatchSize() const TRTNOEXCEPT = 0;
5683 
5693  TRT_DEPRECATED virtual void allowGPUFallback(bool setFallBackMode) TRTNOEXCEPT = 0;
5694 
5698  virtual int getNbDLACores() const TRTNOEXCEPT = 0;
5699 
5710  TRT_DEPRECATED virtual void setDLACore(int dlaCore) TRTNOEXCEPT = 0;
5711 
5718  TRT_DEPRECATED virtual int getDLACore() const TRTNOEXCEPT = 0;
5719 
5725  TRT_DEPRECATED virtual void reset(nvinfer1::INetworkDefinition& network) TRTNOEXCEPT = 0;
5726 
5727 protected:
5728  virtual ~IBuilder()
5729  {
5730  }
5731 
5732 public:
5744  virtual void setGpuAllocator(IGpuAllocator* allocator) TRTNOEXCEPT = 0;
5745 
5757  TRT_DEPRECATED virtual void setFp16Mode(bool mode) TRTNOEXCEPT = 0;
5758 
5766  TRT_DEPRECATED virtual bool getFp16Mode() const TRTNOEXCEPT = 0;
5767 
5786  TRT_DEPRECATED virtual void setStrictTypeConstraints(bool mode) TRTNOEXCEPT = 0;
5787 
5795  TRT_DEPRECATED virtual bool getStrictTypeConstraints() const TRTNOEXCEPT = 0;
5796 
5802  TRT_DEPRECATED virtual void setRefittable(bool canRefit) TRTNOEXCEPT = 0;
5803 
5811  TRT_DEPRECATED virtual bool getRefittable() const TRTNOEXCEPT = 0;
5812 
5818  TRT_DEPRECATED virtual void setEngineCapability(EngineCapability capability) TRTNOEXCEPT = 0;
5819 
5827  TRT_DEPRECATED virtual EngineCapability getEngineCapability() const TRTNOEXCEPT = 0;
5828 
5834  virtual nvinfer1::IBuilderConfig* createBuilderConfig() TRTNOEXCEPT = 0;
5835 
5842  virtual nvinfer1::ICudaEngine* buildEngineWithConfig(
5843  INetworkDefinition& network, IBuilderConfig& config) TRTNOEXCEPT = 0;
5844 
5855  virtual nvinfer1::INetworkDefinition* createNetworkV2(NetworkDefinitionCreationFlags flags) TRTNOEXCEPT = 0;
5856 
5866  virtual nvinfer1::IOptimizationProfile* createOptimizationProfile() noexcept = 0;
5867 
5877  //
5880  virtual void setErrorRecorder(IErrorRecorder* recorder) TRTNOEXCEPT = 0;
5881 
5892  virtual IErrorRecorder* getErrorRecorder() const TRTNOEXCEPT = 0;
5893 
5897  virtual void reset() TRTNOEXCEPT = 0;
5898 };
5899 
5900 } // namespace nvinfer1
5901 
5902 extern "C" TENSORRTAPI void* createInferBuilder_INTERNAL(void* logger, int version);
5903 
5904 namespace nvinfer1
5905 {
5913 namespace
5914 {
5915 inline IBuilder* createInferBuilder(ILogger& logger)
5916 {
5917  return static_cast<IBuilder*>(createInferBuilder_INTERNAL(&logger, NV_TENSORRT_VERSION));
5918 }
5919 }
5920 }
5921 
5922 #endif
Use SAME padding with prePadding <= postPadding.
An engine for executing inference on a built network, with functionally unsafe features.
Definition: NvInferRuntime.h:1108
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:873
NetworkDefinitionCreationFlag
List of immutable network properties expressed at network creation time. NetworkDefinitionCreationFla...
Definition: NvInfer.h:5382
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:4877
RNNOperation
Enumerates the RNN operations that may be performed by an RNN layer.
Definition: NvInfer.h:2320
A Softmax layer in a network definition.
Definition: NvInfer.h:1798
MatrixOperation
Enumerates the operations that may be performed on a tensor by IMatrixMultiplyLayer before multiplica...
Definition: NvInfer.h:3527
Definition: NvInfer.h:3179
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:343
constexpr int EnumMax< RNNDirection >()
Maximum number of elements in RNNDirection enum.
Definition: NvInfer.h:2348
Single gate RNN w/ TANH activation function.
Layer that represents an unary operation.
Definition: NvInfer.h:3033
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: NvInferRuntimeCommon.h:112
An Activation layer in a network definition.
Definition: NvInfer.h:1279
BuilderFlag
Definition: NvInfer.h:5068
constexpr int EnumMax< PaddingMode >()
Maximum number of elements in PaddingMode enum.
Definition: NvInfer.h:884
int w() const
Get the width.
Definition: NvInfer.h:400
RNNDirection
Enumerates the RNN direction that may be performed by an RNN layer.
Definition: NvInfer.h:2341
Layer that represents a Matrix Multiplication.
Definition: NvInfer.h:3580
DimsCHW()
Construct an empty DimsCHW object.
Definition: NvInfer.h:212
No operation is performed on the first recurrent layer.
Holds properties for configuring a builder to produce an engine.
Definition: NvInfer.h:5089
CalibrationAlgoType getAlgorithm() override
Definition: NvInfer.h:4979
constexpr int EnumMax< RNNOperation >()
Maximum number of elements in RNNOperation enum.
Definition: NvInfer.h:2329
A convolution layer in a network definition.
Definition: NvInfer.h:901
A RaggedSoftmax layer in a network definition.
Definition: NvInfer.h:3635
ScaleMode
Controls how shift, scale and power are applied in a Scale layer.
Definition: NvInfer.h:1674
Plugin class for user-implemented layers.
Definition: NvInferRuntime.h:134
Layer that represents a constant value.
Definition: NvInfer.h:3661
A Scale layer in a network definition.
Definition: NvInfer.h:1709
Layer type for getting shape of a tensor.
Definition: NvInfer.h:3440
Enable FP16 layer selection.
Use SAME padding, with prePadding >= postPadding.
static const int MAX_DIMS
The maximum number of dimensions supported for a tensor.
Definition: NvInferRuntimeCommon.h:208
A fully connected layer in a network definition. This layer expects an input tensor of three or more ...
Definition: NvInfer.h:1215
Use CAFFE padding, rounding output size down.
Layer that represents a parametric ReLU operation.
Definition: NvInfer.h:3711
ReduceOperation
Enumerates the reduce operations that may be performed by a Reduce layer.
Definition: NvInfer.h:3059
A LRN layer in a network definition.
Definition: NvInfer.h:1602
Descriptor for three-dimensional data.
Definition: NvInfer.h:172
constexpr int EnumMax< ElementWiseOperation >()
Maximum number of elements in ElementWiseOperation enum.
Definition: NvInfer.h:2158
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:5059
TensorLocation
The location for tensor data storage, device or host.
Definition: NvInferRuntimeCommon.h:925
UnaryOp operation Layer.
Definition: NvInfer.h:2204
Builds an engine from a network definition.
Definition: NvInfer.h:5417
Layer that represents a TopK reduction.
Definition: NvInfer.h:3470
int n() const
Get the index count.
Definition: NvInfer.h:358
An RNN layer in a network definition, version 2.
Definition: NvInfer.h:2751
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:443
CalibrationAlgoType getAlgorithm() override
Definition: NvInfer.h:4994
int & n()
Get the index count.
Definition: NvInfer.h:351
int & w()
Get the width.
Definition: NvInfer.h:266
Layer that represents a reduction operator.
Definition: NvInfer.h:3081
Definition: NvInfer.h:5002
PoolingType
The type of pooling to perform in a pooling layer.
Definition: NvInfer.h:1340
int h() const
Get the height.
Definition: NvInfer.h:151
Sum of the two elements.
Inverse hyperbolic tangent.
int & w()
Get the width.
Definition: NvInfer.h:158
CalibrationAlgoType getAlgorithm() override
Definition: NvInfer.h:5008
int h() const
Get the height.
Definition: NvInfer.h:259
void * createInferBuilder_INTERNAL(void *logger, int version)
Internal C entry point for creating IBuilder.
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:3891
Like kNONE, but transpose the matrix dimensions.
int w() const
Get the width.
Definition: NvInfer.h:165
Divide the first element by the second.
Layer type for pluginV2.
Definition: NvInfer.h:2976
Product of the two elements.
int c() const
Get the channel count.
Definition: NvInfer.h:372
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:3451
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:211
Optimization profile for dynamic input dimensions and shape tensors.
Definition: NvInferRuntime.h:990
Inverse hyperbolic cosine.
A resize layer in a network definition.
Definition: NvInfer.h:3754
constexpr int EnumMax< BuilderFlag >()
Maximum number of builder flags in BuilderFlag enum.
Definition: NvInfer.h:5079
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:698
Reference counted application-implemented error reporting interface for TensorRT objects.
Definition: NvInferRuntimeCommon.h:1141
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:3320
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:205
Network iterates from first to last and vice versa and outputs concatenated.
Layer type for shuffling data.
Definition: NvInfer.h:3202
DimsCHW(int channels, int height, int width)
Construct a DimsCHW given channel count, height and width.
Definition: NvInfer.h:226
Definition: NvInfer.h:4973
A elementwise layer in a network definition.
Definition: NvInfer.h:2174
A Pooling layer in a network definition.
Definition: NvInfer.h:1361
constexpr int EnumMax< UnaryOperation >()
Maximum number of elements in UnaryOperation enum.
Definition: NvInfer.h:3021
int d[MAX_DIMS]
The extent of each dimension.
Definition: NvInferRuntimeCommon.h:210
Application-implemented interface to compute layer output sizes.
Definition: NvInfer.h:2919
Minimum of the two elements.
ElementWiseOperation
Enumerates the binary operations that may be performed by an ElementWise layer.
Definition: NvInfer.h:2145
Three-gate network consisting of Gated Recurrent Units.
RNNGateType
Identifies an individual gate within an RNN cell.
Definition: NvInfer.h:2725
Network iterations from first input to last input.
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:220
A tensor in a network definition.
Definition: NvInfer.h:457
An array of weights used as a layer parameter.
Definition: NvInferRuntime.h:98
int & w()
Get the width.
Definition: NvInfer.h:393
Enable Int8 layer selection.
Mark the network to be an explicit precision network.
int c() const
Get the channel count.
Definition: NvInfer.h:245
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:209
Application-implemented interface for calibration.
Definition: NvInfer.h:4893
Application-implemented logging interface for the builder, engine and runtime.
Definition: NvInferRuntimeCommon.h:985
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:3069
int w() const
Get the width.
Definition: NvInfer.h:273
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:3140
Floor division of the first element by the second.
Definition: NvInfer.h:4988
constexpr int EnumMax< RNNGateType >()
Maximum number of elements in RNNGateType enum.
Definition: NvInfer.h:2737
constexpr int EnumMax< RNNInputMode >()
Maximum number of elements in RNNInputMode enum.
Definition: NvInfer.h:2375
Enable debugging of layers via synchronizing after every layer.
CalibrationAlgoType
Version of calibration algorithm to use.
Definition: NvInfer.h:4868
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:3649
RNNInputMode
Enumerates the RNN input modes that may occur with an RNN layer.
Definition: NvInfer.h:2368
A RNN layer in a network definition.
Definition: NvInfer.h:2391
Layer type for plugins.
Definition: NvInfer.h:2953
int h() const
Get the height.
Definition: NvInfer.h:386
uint32_t NetworkDefinitionCreationFlags
This bitset is capable of representing one or more NetworkDefinitionCreationFlag flags constructed wi...
Definition: NvInfer.h:5371
Four-gate LSTM network w/o peephole connections.
constexpr int EnumMax< MatrixOperation >()
Maximum number of elements in MatrixOperation enum.
Definition: NvInfer.h:3550
#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:942
constexpr int EnumMax< TopKOperation >()
Maximum number of elements in TopKOperation enum.
Definition: NvInfer.h:3458
constexpr int EnumMax< PoolingType >()
Maximum number of elements in PoolingType enum.
Definition: NvInfer.h:1348
constexpr int EnumMax< ScaleMode >()
Maximum number of elements in ScaleMode enum.
Definition: NvInfer.h:1682
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:2997
constexpr int EnumMax< ResizeMode >()
Maximum number of elements in ResizeMode enum.
Definition: NvInfer.h:3729
DeviceType
The device that this layer/network will execute on.
Definition: NvInferRuntime.h:672
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:1853
ResizeMode
Enumerates various modes of resize in the resize layer. Resize mode set using setResizeMode().
Definition: NvInfer.h:3722
CalibrationAlgoType getAlgorithm() override
Definition: NvInfer.h:4964
Inverse hyperbolic sine.
A deconvolution layer in a network definition.
Definition: NvInfer.h:1886
Use CAFFE padding, rounding output size up.
Definition: NvInfer.h:4958