TensorRT 8.4.0
NvInfer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1993-2022, 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 "NvInferLegacyDims.h"
54#include "NvInferRuntime.h"
55
64//
67
73
79namespace nvinfer1
80{
81
89enum class LayerType : int32_t
90{
91 kCONVOLUTION = 0,
93 kACTIVATION = 2,
94 kPOOLING = 3,
95 kLRN = 4,
96 kSCALE = 5,
97 kSOFTMAX = 6,
98 kDECONVOLUTION = 7,
99 kCONCATENATION = 8,
100 kELEMENTWISE = 9,
101 kPLUGIN = 10,
102 kUNARY = 11,
103 kPADDING = 12,
104 kSHUFFLE = 13,
105 kREDUCE = 14,
106 kTOPK = 15,
107 kGATHER = 16,
108 kMATRIX_MULTIPLY = 17,
109 kRAGGED_SOFTMAX = 18,
110 kCONSTANT = 19,
111 kRNN_V2 = 20,
112 kIDENTITY = 21,
113 kPLUGIN_V2 = 22,
114 kSLICE = 23,
115 kSHAPE = 24,
116 kPARAMETRIC_RELU = 25,
117 kRESIZE = 26,
118 kTRIP_LIMIT = 27,
119 kRECURRENCE = 28,
120 kITERATOR = 29,
121 kLOOP_OUTPUT = 30,
122 kSELECT = 31,
123 kFILL = 32,
124 kQUANTIZE = 33,
125 kDEQUANTIZE = 34,
126 kCONDITION = 35,
127 kCONDITIONAL_INPUT = 36,
129 kSCATTER = 38,
130 kEINSUM = 39,
131 kASSERTION = 40,
132};
133
139template <>
140constexpr inline int32_t EnumMax<LayerType>() noexcept
141{
142 return 41;
143}
144
151using TensorFormats = uint32_t;
152
158enum class ActivationType : int32_t
159{
160 kRELU = 0,
161 kSIGMOID = 1,
162 kTANH = 2,
163 kLEAKY_RELU = 3,
164 kELU = 4,
165 kSELU = 5,
166 kSOFTSIGN = 6,
167 kSOFTPLUS = 7,
168 kCLIP = 8,
169 kHARD_SIGMOID = 9,
170 kSCALED_TANH = 10,
172};
173
174namespace impl
175{
181template <>
183{
184 static constexpr int32_t kVALUE = 12;
185};
186} // namespace impl
187
203class ITensor : public INoCopy
204{
205public:
218 void setName(const char* name) noexcept
219 {
220 mImpl->setName(name);
221 }
222
230 const char* getName() const noexcept
231 {
232 return mImpl->getName();
233 }
234
249 void setDimensions(Dims dimensions) noexcept
250 {
251 mImpl->setDimensions(dimensions);
252 }
253
262 Dims getDimensions() const noexcept
263 {
264 return mImpl->getDimensions();
265 }
266
277 void setType(DataType type) noexcept
278 {
279 mImpl->setType(type);
280 }
281
289 DataType getType() const noexcept
290 {
291 return mImpl->getType();
292 }
293
304 bool setDynamicRange(float min, float max) noexcept
305 {
306 return mImpl->setDynamicRange(min, max);
307 }
308
312 bool isNetworkInput() const noexcept
313 {
314 return mImpl->isNetworkInput();
315 }
316
320 bool isNetworkOutput() const noexcept
321 {
322 return mImpl->isNetworkOutput();
323 }
324
342 void setBroadcastAcrossBatch(bool broadcastAcrossBatch) noexcept
343 {
344 mImpl->setBroadcastAcrossBatch(broadcastAcrossBatch);
345 }
346
358 bool getBroadcastAcrossBatch() const noexcept
359 {
360 return mImpl->getBroadcastAcrossBatch();
361 }
362
369 {
370 return mImpl->getLocation();
371 }
372
383 void setLocation(TensorLocation location) noexcept
384 {
385 mImpl->setLocation(location);
386 }
387
393 bool dynamicRangeIsSet() const noexcept
394 {
395 return mImpl->dynamicRangeIsSet();
396 }
397
401 void resetDynamicRange() noexcept
402 {
403 mImpl->resetDynamicRange();
404 }
405
411 float getDynamicRangeMin() const noexcept
412 {
413 return mImpl->getDynamicRangeMin();
414 }
415
421 float getDynamicRangeMax() const noexcept
422 {
423 return mImpl->getDynamicRangeMax();
424 }
425
440 void setAllowedFormats(TensorFormats formats) noexcept
441 {
442 mImpl->setAllowedFormats(formats);
443 }
444
454 {
455 return mImpl->getAllowedFormats();
456 }
457
488 bool isShapeTensor() const noexcept
489 {
490 return mImpl->isShapeTensor();
491 }
492
511 bool isExecutionTensor() const noexcept
512 {
513 return mImpl->isExecutionTensor();
514 }
515
516protected:
517 apiv::VTensor* mImpl;
518 virtual ~ITensor() noexcept = default;
519};
520
528class ILayer : public INoCopy
529{
530public:
536 LayerType getType() const noexcept
537 {
538 return mLayer->getType();
539 }
540
548 void setName(const char* name) noexcept
549 {
550 mLayer->setName(name);
551 }
552
556
559 const char* getName() const noexcept
560 {
561 return mLayer->getName();
562 }
563
567 int32_t getNbInputs() const noexcept
568 {
569 return mLayer->getNbInputs();
570 }
571
580 ITensor* getInput(int32_t index) const noexcept
581 {
582 return mLayer->getInput(index);
583 }
584
588 int32_t getNbOutputs() const noexcept
589 {
590 return mLayer->getNbOutputs();
591 }
592
599 ITensor* getOutput(int32_t index) const noexcept
600 {
601 return mLayer->getOutput(index);
602 }
603
616 void setInput(int32_t index, ITensor& tensor) noexcept
617 {
618 return mLayer->setInput(index, tensor);
619 }
620
644 void setPrecision(DataType dataType) noexcept
645 {
646 mLayer->setPrecision(dataType);
647 }
648
656 DataType getPrecision() const noexcept
657 {
658 return mLayer->getPrecision();
659 }
660
668 bool precisionIsSet() const noexcept
669 {
670 return mLayer->precisionIsSet();
671 }
672
678 void resetPrecision() noexcept
679 {
680 mLayer->resetPrecision();
681 }
682
716 void setOutputType(int32_t index, DataType dataType) noexcept
717 {
718 mLayer->setOutputType(index, dataType);
719 }
720
730 DataType getOutputType(int32_t index) const noexcept
731 {
732 return mLayer->getOutputType(index);
733 }
734
743 bool outputTypeIsSet(int32_t index) const noexcept
744 {
745 return mLayer->outputTypeIsSet(index);
746 }
747
755 void resetOutputType(int32_t index) noexcept
756 {
757 return mLayer->resetOutputType(index);
758 }
759
760protected:
761 virtual ~ILayer() noexcept = default;
762 apiv::VLayer* mLayer;
763};
764
987enum class PaddingMode : int32_t
988{
991 kSAME_UPPER = 2,
992 kSAME_LOWER = 3,
994 kCAFFE_ROUND_UP = 5
995};
996
997namespace impl
998{
1004template <>
1006{
1007 static constexpr int32_t kVALUE = 6;
1008};
1009} // namespace impl
1010
1024{
1025public:
1035 TRT_DEPRECATED void setKernelSize(DimsHW kernelSize) noexcept
1036 {
1037 mImpl->setKernelSize(kernelSize);
1038 }
1039
1048 {
1049 return mImpl->getKernelSize();
1050 }
1051
1059 void setNbOutputMaps(int32_t nbOutputMaps) noexcept
1060 {
1061 mImpl->setNbOutputMaps(nbOutputMaps);
1062 }
1063
1069 int32_t getNbOutputMaps() const noexcept
1070 {
1071 return mImpl->getNbOutputMaps();
1072 }
1073
1085 TRT_DEPRECATED void setStride(DimsHW stride) noexcept
1086 {
1087 mImpl->setStride(stride);
1088 }
1089
1096 {
1097 return mImpl->getStride();
1098 }
1099
1115 TRT_DEPRECATED void setPadding(DimsHW padding) noexcept
1116 {
1117 return mImpl->setPadding(padding);
1118 }
1119
1128 {
1129 return mImpl->getPadding();
1130 }
1131
1147 void setNbGroups(int32_t nbGroups) noexcept
1148 {
1149 mImpl->setNbGroups(nbGroups);
1150 }
1151
1157 int32_t getNbGroups() const noexcept
1158 {
1159 return mImpl->getNbGroups();
1160 }
1161
1171 void setKernelWeights(Weights weights) noexcept
1172 {
1173 mImpl->setKernelWeights(weights);
1174 }
1175
1181 Weights getKernelWeights() const noexcept
1182 {
1183 return mImpl->getKernelWeights();
1184 }
1185
1196 void setBiasWeights(Weights weights) noexcept
1197 {
1198 mImpl->setBiasWeights(weights);
1199 }
1200
1206 Weights getBiasWeights() const noexcept
1207 {
1208 return mImpl->getBiasWeights();
1209 }
1210
1222 TRT_DEPRECATED void setDilation(DimsHW dilation) noexcept
1223 {
1224 return mImpl->setDilation(dilation);
1225 }
1226
1235 {
1236 return mImpl->getDilation();
1237 }
1238
1251 void setPrePadding(Dims padding) noexcept
1252 {
1253 mImpl->setPrePadding(padding);
1254 }
1255
1261 Dims getPrePadding() const noexcept
1262 {
1263 return mImpl->getPrePadding();
1264 }
1265
1278 void setPostPadding(Dims padding) noexcept
1279 {
1280 mImpl->setPostPadding(padding);
1281 }
1282
1288 Dims getPostPadding() const noexcept
1289 {
1290 return mImpl->getPostPadding();
1291 }
1292
1302 void setPaddingMode(PaddingMode paddingMode) noexcept
1303 {
1304 mImpl->setPaddingMode(paddingMode);
1305 }
1306
1315 {
1316 return mImpl->getPaddingMode();
1317 }
1318
1327 void setKernelSizeNd(Dims kernelSize) noexcept
1328 {
1329 mImpl->setKernelSizeNd(kernelSize);
1330 }
1331
1337 Dims getKernelSizeNd() const noexcept
1338 {
1339 return mImpl->getKernelSizeNd();
1340 }
1341
1352 void setStrideNd(Dims stride) noexcept
1353 {
1354 mImpl->setStrideNd(stride);
1355 }
1356
1362 Dims getStrideNd() const noexcept
1363 {
1364 return mImpl->getStrideNd();
1365 }
1366
1380 void setPaddingNd(Dims padding) noexcept
1381 {
1382 mImpl->setPaddingNd(padding);
1383 }
1384
1392 Dims getPaddingNd() const noexcept
1393 {
1394 return mImpl->getPaddingNd();
1395 }
1396
1406 void setDilationNd(Dims dilation) noexcept
1407 {
1408 mImpl->setDilationNd(dilation);
1409 }
1410
1416 Dims getDilationNd() const noexcept
1417 {
1418 return mImpl->getDilationNd();
1419 }
1420
1442 using ILayer::setInput;
1443
1444protected:
1445 virtual ~IConvolutionLayer() noexcept = default;
1446 apiv::VConvolutionLayer* mImpl;
1447};
1448
1481{
1482public:
1490 void setNbOutputChannels(int32_t nbOutputs) noexcept
1491 {
1492 mImpl->setNbOutputChannels(nbOutputs);
1493 }
1494
1500 int32_t getNbOutputChannels() const noexcept
1501 {
1502 return mImpl->getNbOutputChannels();
1503 }
1504
1510 void setKernelWeights(Weights weights) noexcept
1511 {
1512 mImpl->setKernelWeights(weights);
1513 }
1514
1520 Weights getKernelWeights() const noexcept
1521 {
1522 return mImpl->getKernelWeights();
1523 }
1524
1532 void setBiasWeights(Weights weights) noexcept
1533 {
1534 mImpl->setBiasWeights(weights);
1535 }
1536
1542 Weights getBiasWeights() const noexcept
1543 {
1544 return mImpl->getBiasWeights();
1545 }
1546
1568 using ILayer::setInput;
1569
1570protected:
1571 virtual ~IFullyConnectedLayer() noexcept = default;
1572 apiv::VFullyConnectedLayer* mImpl;
1573};
1574
1589{
1590public:
1599 {
1600 mImpl->setActivationType(type);
1601 }
1602
1609 {
1610 return mImpl->getActivationType();
1611 }
1612
1623 void setAlpha(float alpha) noexcept
1624 {
1625 mImpl->setAlpha(alpha);
1626 }
1627
1637 void setBeta(float beta) noexcept
1638 {
1639 mImpl->setBeta(beta);
1640 }
1641
1646 float getAlpha() const noexcept
1647 {
1648 return mImpl->getAlpha();
1649 }
1650
1655 float getBeta() const noexcept
1656 {
1657 return mImpl->getBeta();
1658 }
1659
1660protected:
1661 virtual ~IActivationLayer() noexcept = default;
1662 apiv::VActivationLayer* mImpl;
1663};
1664
1670enum class PoolingType : int32_t
1671{
1672 kMAX = 0, // Maximum over elements
1673 kAVERAGE = 1, // Average over elements. If the tensor is padded, the count includes the padding
1674 kMAX_AVERAGE_BLEND = 2 // Blending between max and average pooling: (1-blendFactor)*maxPool + blendFactor*avgPool
1675};
1676
1677namespace impl
1678{
1684template <>
1686{
1687 static constexpr int32_t kVALUE = 3;
1688};
1689} // namespace impl
1690
1702class IPoolingLayer : public ILayer
1703{
1704public:
1712 void setPoolingType(PoolingType type) noexcept
1713 {
1714 mImpl->setPoolingType(type);
1715 }
1716
1723 {
1724 return mImpl->getPoolingType();
1725 }
1726
1736 TRT_DEPRECATED void setWindowSize(DimsHW windowSize) noexcept
1737 {
1738 mImpl->setWindowSize(windowSize);
1739 }
1740
1749 {
1750 return mImpl->getWindowSize();
1751 }
1752
1764 TRT_DEPRECATED void setStride(DimsHW stride) noexcept
1765 {
1766 mImpl->setStride(stride);
1767 }
1768
1777 {
1778 return mImpl->getStride();
1779 }
1780
1792 TRT_DEPRECATED void setPadding(DimsHW padding) noexcept
1793 {
1794 mImpl->setPadding(padding);
1795 }
1796
1807 {
1808 return mImpl->getPadding();
1809 }
1810
1821 void setBlendFactor(float blendFactor) noexcept
1822 {
1823 mImpl->setBlendFactor(blendFactor);
1824 }
1825
1834 float getBlendFactor() const noexcept
1835 {
1836 return mImpl->getBlendFactor();
1837 }
1838
1851 void setAverageCountExcludesPadding(bool exclusive) noexcept
1852 {
1853 mImpl->setAverageCountExcludesPadding(exclusive);
1854 }
1855
1863 {
1864 return mImpl->getAverageCountExcludesPadding();
1865 }
1866
1880 void setPrePadding(Dims padding) noexcept
1881 {
1882 mImpl->setPrePadding(padding);
1883 }
1884
1890 Dims getPrePadding() const noexcept
1891 {
1892 return mImpl->getPrePadding();
1893 }
1894
1908 void setPostPadding(Dims padding) noexcept
1909 {
1910 mImpl->setPostPadding(padding);
1911 }
1912
1918 Dims getPostPadding() const noexcept
1919 {
1920 return mImpl->getPostPadding();
1921 }
1922
1931 void setPaddingMode(PaddingMode paddingMode) noexcept
1932 {
1933 mImpl->setPaddingMode(paddingMode);
1934 }
1935
1943 {
1944 return mImpl->getPaddingMode();
1945 }
1946
1955 void setWindowSizeNd(Dims windowSize) noexcept
1956 {
1957 mImpl->setWindowSizeNd(windowSize);
1958 }
1959
1965 Dims getWindowSizeNd() const noexcept
1966 {
1967 return mImpl->getWindowSizeNd();
1968 }
1969
1980 void setStrideNd(Dims stride) noexcept
1981 {
1982 mImpl->setStrideNd(stride);
1983 }
1984
1990 Dims getStrideNd() const noexcept
1991 {
1992 return mImpl->getStrideNd();
1993 }
1994
2009 void setPaddingNd(Dims padding) noexcept
2010 {
2011 mImpl->setPaddingNd(padding);
2012 }
2013
2021 Dims getPaddingNd() const noexcept
2022 {
2023 return mImpl->getPaddingNd();
2024 }
2025
2026protected:
2027 virtual ~IPoolingLayer() noexcept = default;
2028 apiv::VPoolingLayer* mImpl;
2029};
2030
2040class ILRNLayer : public ILayer
2041{
2042public:
2052 void setWindowSize(int32_t windowSize) noexcept
2053 {
2054 mImpl->setWindowSize(windowSize);
2055 }
2056
2062 int32_t getWindowSize() const noexcept
2063 {
2064 return mImpl->getWindowSize();
2065 }
2066
2073 void setAlpha(float alpha) noexcept
2074 {
2075 mImpl->setAlpha(alpha);
2076 }
2077
2083 float getAlpha() const noexcept
2084 {
2085 return mImpl->getAlpha();
2086 }
2087
2094 void setBeta(float beta) noexcept
2095 {
2096 mImpl->setBeta(beta);
2097 }
2098
2104 float getBeta() const noexcept
2105 {
2106 return mImpl->getBeta();
2107 }
2108
2115 void setK(float k) noexcept
2116 {
2117 mImpl->setK(k);
2118 }
2119
2125 float getK() const noexcept
2126 {
2127 return mImpl->getK();
2128 }
2129
2130protected:
2131 virtual ~ILRNLayer() noexcept = default;
2132 apiv::VLRNLayer* mImpl;
2133};
2134
2140enum class ScaleMode : int32_t
2141{
2142 kUNIFORM = 0,
2143 kCHANNEL = 1,
2144 kELEMENTWISE = 2
2145};
2146
2152template <>
2153constexpr inline int32_t EnumMax<ScaleMode>() noexcept
2154{
2155 return 3;
2156}
2157
2184class IScaleLayer : public ILayer
2185{
2186public:
2192 void setMode(ScaleMode mode) noexcept
2193 {
2194 mImpl->setMode(mode);
2195 }
2196
2202 ScaleMode getMode() const noexcept
2203 {
2204 return mImpl->getMode();
2205 }
2206
2212 void setShift(Weights shift) noexcept
2213 {
2214 mImpl->setShift(shift);
2215 }
2216
2222 Weights getShift() const noexcept
2223 {
2224 return mImpl->getShift();
2225 }
2226
2232 void setScale(Weights scale) noexcept
2233 {
2234 mImpl->setScale(scale);
2235 }
2236
2242 Weights getScale() const noexcept
2243 {
2244 return mImpl->getScale();
2245 }
2246
2252 void setPower(Weights power) noexcept
2253 {
2254 mImpl->setPower(power);
2255 }
2256
2262 Weights getPower() const noexcept
2263 {
2264 return mImpl->getPower();
2265 }
2266
2277 int32_t getChannelAxis() const noexcept
2278 {
2279 return mImpl->getChannelAxis();
2280 }
2281
2298 void setChannelAxis(int32_t channelAxis) noexcept
2299 {
2300 mImpl->setChannelAxis(channelAxis);
2301 }
2302
2303protected:
2304 virtual ~IScaleLayer() noexcept = default;
2305 apiv::VScaleLayer* mImpl;
2306};
2307
2324class ISoftMaxLayer : public ILayer
2325{
2326public:
2359 void setAxes(uint32_t axes) noexcept
2360 {
2361 mImpl->setAxes(axes);
2362 }
2363
2369 uint32_t getAxes() const noexcept
2370 {
2371 return mImpl->getAxes();
2372 }
2373
2374protected:
2375 virtual ~ISoftMaxLayer() noexcept = default;
2376 apiv::VSoftMaxLayer* mImpl;
2377};
2378
2392{
2393public:
2404 void setAxis(int32_t axis) noexcept
2405 {
2406 mImpl->setAxis(axis);
2407 }
2408
2414 int32_t getAxis() const noexcept
2415 {
2416 return mImpl->getAxis();
2417 }
2418
2419protected:
2420 virtual ~IConcatenationLayer() noexcept = default;
2421 apiv::VConcatenationLayer* mImpl;
2422};
2423
2432{
2433public:
2445 TRT_DEPRECATED void setKernelSize(DimsHW kernelSize) noexcept
2446 {
2447 mImpl->setKernelSize(kernelSize);
2448 }
2449
2458 {
2459 return mImpl->getKernelSize();
2460 }
2461
2469 void setNbOutputMaps(int32_t nbOutputMaps) noexcept
2470 {
2471 mImpl->setNbOutputMaps(nbOutputMaps);
2472 }
2473
2479 int32_t getNbOutputMaps() const noexcept
2480 {
2481 return mImpl->getNbOutputMaps();
2482 }
2483
2495 TRT_DEPRECATED void setStride(DimsHW stride) noexcept
2496 {
2497 mImpl->setStride(stride);
2498 }
2499
2508 {
2509 return mImpl->getStride();
2510 }
2511
2527 TRT_DEPRECATED void setPadding(DimsHW padding) noexcept
2528 {
2529 mImpl->setPadding(padding);
2530 }
2531
2542 {
2543 return mImpl->getPadding();
2544 }
2545
2561 void setNbGroups(int32_t nbGroups) noexcept
2562 {
2563 mImpl->setNbGroups(nbGroups);
2564 }
2565
2571 int32_t getNbGroups() const noexcept
2572 {
2573 return mImpl->getNbGroups();
2574 }
2575
2585 void setKernelWeights(Weights weights) noexcept
2586 {
2587 mImpl->setKernelWeights(weights);
2588 }
2589
2595 Weights getKernelWeights() const noexcept
2596 {
2597 return mImpl->getKernelWeights();
2598 }
2599
2610 void setBiasWeights(Weights weights) noexcept
2611 {
2612 mImpl->setBiasWeights(weights);
2613 }
2614
2620 Weights getBiasWeights() const noexcept
2621 {
2622 return mImpl->getBiasWeights();
2623 }
2624
2638 void setPrePadding(Dims padding) noexcept
2639 {
2640 mImpl->setPrePadding(padding);
2641 }
2642
2648 Dims getPrePadding() const noexcept
2649 {
2650 return mImpl->getPrePadding();
2651 }
2652
2666 void setPostPadding(Dims padding) noexcept
2667 {
2668 mImpl->setPostPadding(padding);
2669 }
2670
2676 Dims getPostPadding() const noexcept
2677 {
2678 return mImpl->getPostPadding();
2679 }
2680
2690 void setPaddingMode(PaddingMode paddingMode) noexcept
2691 {
2692 mImpl->setPaddingMode(paddingMode);
2693 }
2694
2703 {
2704 return mImpl->getPaddingMode();
2705 }
2706
2717 void setKernelSizeNd(Dims kernelSize) noexcept
2718 {
2719 mImpl->setKernelSizeNd(kernelSize);
2720 }
2721
2727 Dims getKernelSizeNd() const noexcept
2728 {
2729 return mImpl->getKernelSizeNd();
2730 }
2731
2744 void setStrideNd(Dims stride) noexcept
2745 {
2746 mImpl->setStrideNd(stride);
2747 }
2748
2754 Dims getStrideNd() const noexcept
2755 {
2756 return mImpl->getStrideNd();
2757 }
2758
2772 void setPaddingNd(Dims padding) noexcept
2773 {
2774 mImpl->setPaddingNd(padding);
2775 }
2776
2784 Dims getPaddingNd() const noexcept
2785 {
2786 return mImpl->getPaddingNd();
2787 }
2788
2810 using ILayer::setInput;
2811
2818 void setDilationNd(Dims dilation) noexcept
2819 {
2820 mImpl->setDilationNd(dilation);
2821 }
2822
2828 Dims getDilationNd() const noexcept
2829 {
2830 return mImpl->getDilationNd();
2831 }
2832
2833protected:
2834 virtual ~IDeconvolutionLayer() noexcept = default;
2835 apiv::VDeconvolutionLayer* mImpl;
2836};
2837
2851enum class ElementWiseOperation : int32_t
2852{
2853 kSUM = 0,
2854 kPROD = 1,
2855 kMAX = 2,
2856 kMIN = 3,
2857 kSUB = 4,
2858 kDIV = 5,
2859 kPOW = 6,
2860 kFLOOR_DIV = 7,
2861 kAND = 8,
2862 kOR = 9,
2863 kXOR = 10,
2864 kEQUAL = 11,
2865 kGREATER = 12,
2866 kLESS = 13
2867};
2868
2869namespace impl
2870{
2876template <>
2878{
2879 static constexpr int32_t kVALUE = 14;
2880};
2881} // namespace impl
2882
2903{
2904public:
2915 {
2916 return mImpl->setOperation(op);
2917 }
2918
2927 {
2928 return mImpl->getOperation();
2929 }
2930
2931protected:
2932 apiv::VElementWiseLayer* mImpl;
2933 virtual ~IElementWiseLayer() noexcept = default;
2934};
2935
2941enum class GatherMode : int32_t
2942{
2943 kDEFAULT = 0,
2944 kELEMENT = 1,
2945 kND = 2
2946};
2947
2953template <>
2954constexpr inline int32_t EnumMax<GatherMode>() noexcept
2955{
2956 return 3;
2957}
2958
3037class IGatherLayer : public ILayer
3038{
3039public:
3049 void setGatherAxis(int32_t axis) noexcept
3050 {
3051 mImpl->setGatherAxis(axis);
3052 }
3053
3060 int32_t getGatherAxis() const noexcept
3061 {
3062 return mImpl->getGatherAxis();
3063 }
3064
3081 void setNbElementWiseDims(int32_t elementWiseDims) noexcept
3082 {
3083 mImpl->setNbElementWiseDims(elementWiseDims);
3084 }
3085
3091 int32_t getNbElementWiseDims() const noexcept
3092 {
3093 return mImpl->getNbElementWiseDims();
3094 }
3095
3101 void setMode(GatherMode mode) noexcept
3102 {
3103 mImpl->setMode(mode);
3104 }
3105
3111 GatherMode getMode() const noexcept
3112 {
3113 return mImpl->getMode();
3114 }
3115
3116protected:
3117 apiv::VGatherLayer* mImpl;
3118 virtual ~IGatherLayer() noexcept = default;
3119};
3120
3200enum class RNNOperation : int32_t
3201{
3202 kRELU = 0,
3203 kTANH = 1,
3204 kLSTM = 2,
3205 kGRU = 3
3206};
3207
3213template <>
3214constexpr inline int32_t EnumMax<RNNOperation>() noexcept
3215{
3216 return 4;
3217}
3218
3226enum class RNNDirection : int32_t
3227{
3228 kUNIDIRECTION = 0,
3229 kBIDIRECTION = 1
3230};
3231
3237template <>
3238constexpr inline int32_t EnumMax<RNNDirection>() noexcept
3239{
3240 return 2;
3241}
3242
3258enum class RNNInputMode : int32_t
3259{
3260 kLINEAR = 0,
3261 kSKIP = 1
3262};
3263
3269template <>
3270constexpr inline int32_t EnumMax<RNNInputMode>() noexcept
3271{
3272 return 2;
3273}
3274
3282enum class RNNGateType : int32_t
3283{
3284 kINPUT = 0,
3285 kOUTPUT = 1,
3286 kFORGET = 2,
3287 kUPDATE = 3,
3288 kRESET = 4,
3289 kCELL = 5,
3290 kHIDDEN = 6
3291};
3292
3298template <>
3299constexpr inline int32_t EnumMax<RNNGateType>() noexcept
3300{
3301 return 7;
3302}
3303
3316{
3317public:
3318 int32_t getLayerCount() const noexcept
3319 {
3320 return mImpl->getLayerCount();
3321 }
3322 int32_t getHiddenSize() const noexcept
3323 {
3324 return mImpl->getHiddenSize();
3325 }
3326 int32_t getMaxSeqLength() const noexcept
3327 {
3328 return mImpl->getMaxSeqLength();
3329 }
3330 int32_t getDataLength() const noexcept
3331 {
3332 return mImpl->getDataLength();
3333 }
3334
3349 void setSequenceLengths(ITensor& seqLengths) noexcept
3350 {
3351 return mImpl->setSequenceLengths(seqLengths);
3352 }
3353
3361 ITensor* getSequenceLengths() const noexcept
3362 {
3363 return mImpl->getSequenceLengths();
3364 }
3365
3371 void setOperation(RNNOperation op) noexcept
3372 {
3373 mImpl->setOperation(op);
3374 }
3375
3382 {
3383 return mImpl->getOperation();
3384 }
3385
3391 void setInputMode(RNNInputMode op) noexcept
3392 {
3393 mImpl->setInputMode(op);
3394 }
3395
3402 {
3403 return mImpl->getInputMode();
3404 }
3405
3416 void setDirection(RNNDirection op) noexcept
3417 {
3418 mImpl->setDirection(op);
3419 }
3420
3427 {
3428 return mImpl->getDirection();
3429 }
3430
3485 void setWeightsForGate(int32_t layerIndex, RNNGateType gate, bool isW, Weights weights) noexcept
3486 {
3487 mImpl->setWeightsForGate(layerIndex, gate, isW, weights);
3488 }
3489
3495 Weights getWeightsForGate(int32_t layerIndex, RNNGateType gate, bool isW) const noexcept
3496 {
3497 return mImpl->getWeightsForGate(layerIndex, gate, isW);
3498 }
3499
3520 void setBiasForGate(int32_t layerIndex, RNNGateType gate, bool isW, Weights bias) noexcept
3521 {
3522 mImpl->setBiasForGate(layerIndex, gate, isW, bias);
3523 }
3524
3530 Weights getBiasForGate(int32_t layerIndex, RNNGateType gate, bool isW) const noexcept
3531 {
3532 return mImpl->getBiasForGate(layerIndex, gate, isW);
3533 }
3534
3547 void setHiddenState(ITensor& hidden) noexcept
3548 {
3549 mImpl->setHiddenState(hidden);
3550 }
3551
3557 ITensor* getHiddenState() const noexcept
3558 {
3559 return mImpl->getHiddenState();
3560 }
3561
3576 void setCellState(ITensor& cell) noexcept
3577 {
3578 mImpl->setCellState(cell);
3579 }
3580
3586 ITensor* getCellState() const noexcept
3587 {
3588 return mImpl->getCellState();
3589 }
3590
3591protected:
3592 apiv::VRNNv2Layer* mImpl;
3593 virtual ~IRNNv2Layer() noexcept = default;
3594};
3595
3606{
3607public:
3614 {
3615 return mImpl->getPlugin();
3616 }
3617
3618protected:
3619 apiv::VPluginV2Layer* mImpl;
3620 virtual ~IPluginV2Layer() noexcept = default;
3621};
3622
3636enum class UnaryOperation : int32_t
3637{
3638 kEXP = 0,
3639 kLOG = 1,
3640 kSQRT = 2,
3641 kRECIP = 3,
3642 kABS = 4,
3643 kNEG = 5,
3644 kSIN = 6,
3645 kCOS = 7,
3646 kTAN = 8,
3647 kSINH = 9,
3648 kCOSH = 10,
3649 kASIN = 11,
3650 kACOS = 12,
3651 kATAN = 13,
3652 kASINH = 14,
3653 kACOSH = 15,
3654 kATANH = 16,
3655 kCEIL = 17,
3656 kFLOOR = 18,
3657 kERF = 19,
3658 kNOT = 20,
3659 kSIGN = 21,
3660 kROUND = 22
3661};
3662
3668template <>
3669constexpr inline int32_t EnumMax<UnaryOperation>() noexcept
3670{
3671 return 23;
3672}
3673
3681class IUnaryLayer : public ILayer
3682{
3683public:
3692 {
3693 mImpl->setOperation(op);
3694 }
3695
3702 {
3703 return mImpl->getOperation();
3704 }
3705
3706protected:
3707 apiv::VUnaryLayer* mImpl;
3708 virtual ~IUnaryLayer() noexcept = default;
3709};
3710
3729enum class ReduceOperation : int32_t
3730{
3731 kSUM = 0,
3732 kPROD = 1,
3733 kMAX = 2,
3734 kMIN = 3,
3735 kAVG = 4
3736};
3737
3743template <>
3744constexpr inline int32_t EnumMax<ReduceOperation>() noexcept
3745{
3746 return 5;
3747}
3748
3756class IReduceLayer : public ILayer
3757{
3758public:
3765 {
3766 mImpl->setOperation(op);
3767 }
3768
3775 {
3776 return mImpl->getOperation();
3777 }
3778
3784 void setReduceAxes(uint32_t reduceAxes) noexcept
3785 {
3786 mImpl->setReduceAxes(reduceAxes);
3787 }
3788
3794 uint32_t getReduceAxes() const noexcept
3795 {
3796 return mImpl->getReduceAxes();
3797 }
3798
3804 void setKeepDimensions(bool keepDimensions) noexcept
3805 {
3806 mImpl->setKeepDimensions(keepDimensions);
3807 }
3808
3814 bool getKeepDimensions() const noexcept
3815 {
3816 return mImpl->getKeepDimensions();
3817 }
3818
3819protected:
3820 apiv::VReduceLayer* mImpl;
3821 virtual ~IReduceLayer() noexcept = default;
3822};
3823
3834class IPaddingLayer : public ILayer
3835{
3836public:
3846 TRT_DEPRECATED void setPrePadding(DimsHW padding) noexcept
3847 {
3848 mImpl->setPrePadding(padding);
3849 }
3850
3859 {
3860 return mImpl->getPrePadding();
3861 }
3862
3872 TRT_DEPRECATED void setPostPadding(DimsHW padding) noexcept
3873 {
3874 mImpl->setPostPadding(padding);
3875 }
3876
3885 {
3886 return mImpl->getPostPadding();
3887 }
3888
3898 void setPrePaddingNd(Dims padding) noexcept
3899 {
3900 mImpl->setPrePaddingNd(padding);
3901 }
3902
3910 Dims getPrePaddingNd() const noexcept
3911 {
3912 return mImpl->getPrePaddingNd();
3913 }
3914
3924 void setPostPaddingNd(Dims padding) noexcept
3925 {
3926 mImpl->setPostPaddingNd(padding);
3927 }
3928
3936 Dims getPostPaddingNd() const noexcept
3937 {
3938 return mImpl->getPostPaddingNd();
3939 }
3940
3941protected:
3942 apiv::VPaddingLayer* mImpl;
3943 virtual ~IPaddingLayer() noexcept = default;
3944};
3945
3947{
3954 int32_t order[Dims::MAX_DIMS];
3955};
3956
3969class IShuffleLayer : public ILayer
3970{
3971public:
3981 void setFirstTranspose(Permutation permutation) noexcept
3982 {
3983 mImpl->setFirstTranspose(permutation);
3984 }
3985
3994 {
3995 return mImpl->getFirstTranspose();
3996 }
3997
4018 void setReshapeDimensions(Dims dimensions) noexcept
4019 {
4020 mImpl->setReshapeDimensions(dimensions);
4021 }
4022
4032 {
4033 return mImpl->getReshapeDimensions();
4034 }
4035
4041 //
4064 using ILayer::setInput;
4065
4078 void setSecondTranspose(Permutation permutation) noexcept
4079 {
4080 mImpl->setSecondTranspose(permutation);
4081 }
4082
4091 {
4092 return mImpl->getSecondTranspose();
4093 }
4094
4106 void setZeroIsPlaceholder(bool zeroIsPlaceholder) noexcept
4107 {
4108 return mImpl->setZeroIsPlaceholder(zeroIsPlaceholder);
4109 }
4110
4119 bool getZeroIsPlaceholder() const noexcept
4120 {
4121 return mImpl->getZeroIsPlaceholder();
4122 }
4123
4124protected:
4125 apiv::VShuffleLayer* mImpl;
4126 virtual ~IShuffleLayer() noexcept = default;
4127};
4128
4134enum class SliceMode : int32_t
4135{
4136 kDEFAULT = 0,
4137 kWRAP = 1,
4138 kCLAMP = 2,
4139 kFILL = 3,
4140 kREFLECT = 4,
4143};
4144
4150template <>
4151constexpr inline int32_t EnumMax<SliceMode>() noexcept
4152{
4153 return 5;
4154}
4155
4191class ISliceLayer : public ILayer
4192{
4193public:
4203 void setStart(Dims start) noexcept
4204 {
4205 mImpl->setStart(start);
4206 }
4207
4218 Dims getStart() const noexcept
4219 {
4220 return mImpl->getStart();
4221 }
4222
4232 void setSize(Dims size) noexcept
4233 {
4234 return mImpl->setSize(size);
4235 }
4236
4247 Dims getSize() const noexcept
4248 {
4249 return mImpl->getSize();
4250 }
4251
4261 void setStride(Dims stride) noexcept
4262 {
4263 mImpl->setStride(stride);
4264 }
4265
4276 Dims getStride() const noexcept
4277 {
4278 return mImpl->getStride();
4279 }
4280
4286 void setMode(SliceMode mode) noexcept
4287 {
4288 mImpl->setMode(mode);
4289 }
4290
4296 SliceMode getMode() const noexcept
4297 {
4298 return mImpl->getMode();
4299 }
4300
4322 using ILayer::setInput;
4323
4324protected:
4325 apiv::VSliceLayer* mImpl;
4326 virtual ~ISliceLayer() noexcept = default;
4327};
4328
4341class IShapeLayer : public ILayer
4342{
4343protected:
4344 apiv::VShapeLayer* mImpl;
4345 virtual ~IShapeLayer() noexcept = default;
4346};
4347
4353enum class TopKOperation : int32_t
4354{
4355 kMAX = 0,
4356 kMIN = 1,
4357};
4358
4364template <>
4365constexpr inline int32_t EnumMax<TopKOperation>() noexcept
4366{
4367 return 2;
4368}
4369
4377class ITopKLayer : public ILayer
4378{
4379public:
4385 void setOperation(TopKOperation op) noexcept
4386 {
4387 mImpl->setOperation(op);
4388 }
4389
4396 {
4397 return mImpl->getOperation();
4398 }
4399
4407 void setK(int32_t k) noexcept
4408 {
4409 mImpl->setK(k);
4410 }
4411
4417 int32_t getK() const noexcept
4418 {
4419 return mImpl->getK();
4420 }
4421
4427 void setReduceAxes(uint32_t reduceAxes) noexcept
4428 {
4429 mImpl->setReduceAxes(reduceAxes);
4430 }
4431
4437 uint32_t getReduceAxes() const noexcept
4438 {
4439 return mImpl->getReduceAxes();
4440 }
4441
4442protected:
4443 apiv::VTopKLayer* mImpl;
4444 virtual ~ITopKLayer() noexcept = default;
4445};
4446
4453enum class MatrixOperation : int32_t
4454{
4458 kNONE,
4459
4461 kTRANSPOSE,
4462
4473 kVECTOR
4474};
4475
4481template <>
4482constexpr inline int32_t EnumMax<MatrixOperation>() noexcept
4483{
4484 return 3;
4485}
4486
4513{
4514public:
4521 void setOperation(int32_t index, MatrixOperation op) noexcept
4522 {
4523 mImpl->setOperation(index, op);
4524 }
4525
4533 MatrixOperation getOperation(int32_t index) const noexcept
4534 {
4535 return mImpl->getOperation(index);
4536 }
4537
4538protected:
4539 apiv::VMatrixMultiplyLayer* mImpl;
4540 virtual ~IMatrixMultiplyLayer() noexcept = default;
4541};
4542
4558{
4559protected:
4560 apiv::VRaggedSoftMaxLayer* mImpl;
4561 virtual ~IRaggedSoftMaxLayer() noexcept = default;
4562};
4563
4588{
4589protected:
4590 apiv::VIdentityLayer* mImpl;
4591 virtual ~IIdentityLayer() noexcept = default;
4592};
4593
4603{
4604public:
4614 void setWeights(Weights weights) noexcept
4615 {
4616 mImpl->setWeights(weights);
4617 }
4618
4624 Weights getWeights() const noexcept
4625 {
4626 return mImpl->getWeights();
4627 }
4628
4636 void setDimensions(Dims dimensions) noexcept
4637 {
4638 mImpl->setDimensions(dimensions);
4639 }
4640
4648 Dims getDimensions() const noexcept
4649 {
4650 return mImpl->getDimensions();
4651 }
4652
4653protected:
4654 apiv::VConstantLayer* mImpl;
4655 virtual ~IConstantLayer() noexcept = default;
4656};
4657
4668{
4669protected:
4670 apiv::VParametricReLULayer* mImpl;
4671 virtual ~IParametricReLULayer() noexcept = default;
4672};
4673
4679enum class ResizeMode : int32_t
4680{
4681 kNEAREST = 0,
4682 kLINEAR = 1
4683};
4684
4685namespace impl
4686{
4692template <>
4694{
4695 static constexpr int32_t kVALUE = 2;
4696};
4697} // namespace impl
4698
4707{
4720 kALIGN_CORNERS = 0,
4721
4728 kASYMMETRIC = 1,
4729
4736 kHALF_PIXEL = 2,
4737};
4738
4739namespace impl
4740{
4746template <>
4748{
4749 static constexpr int32_t kVALUE = 3;
4750};
4751} // namespace impl
4752
4760enum class ResizeSelector : int32_t
4761{
4763 kFORMULA = 0,
4764
4766 kUPPER = 1,
4767};
4768
4769namespace impl
4770{
4776template <>
4778{
4779 static constexpr int32_t kVALUE = 2;
4780};
4781} // namespace impl
4782
4790enum class ResizeRoundMode : int32_t
4791{
4793 kHALF_UP = 0,
4794
4796 kHALF_DOWN = 1,
4797
4799 kFLOOR = 2,
4800
4802 kCEIL = 3,
4803};
4804
4805namespace impl
4806{
4812template <>
4814{
4815 static constexpr int32_t kVALUE = 4;
4816};
4817} // namespace impl
4818
4855class IResizeLayer : public ILayer
4856{
4857public:
4876 void setOutputDimensions(Dims dimensions) noexcept
4877 {
4878 return mImpl->setOutputDimensions(dimensions);
4879 }
4880
4886 Dims getOutputDimensions() const noexcept
4887 {
4888 return mImpl->getOutputDimensions();
4889 }
4890
4916 void setScales(const float* scales, int32_t nbScales) noexcept
4917 {
4918 mImpl->setScales(scales, nbScales);
4919 }
4920
4935 int32_t getScales(int32_t size, float* scales) const noexcept
4936 {
4937 return mImpl->getScales(size, scales);
4938 }
4939
4947 void setResizeMode(ResizeMode resizeMode) noexcept
4948 {
4949 mImpl->setResizeMode(resizeMode);
4950 }
4951
4957 ResizeMode getResizeMode() const noexcept
4958 {
4959 return mImpl->getResizeMode();
4960 }
4961
4973 TRT_DEPRECATED void setAlignCorners(bool alignCorners) noexcept
4974 {
4975 mImpl->setAlignCorners(alignCorners);
4976 }
4977
4985 TRT_DEPRECATED bool getAlignCorners() const noexcept
4986 {
4987 return mImpl->getAlignCorners();
4988 }
4989
5009 using ILayer::setInput;
5010
5021 {
5022 mImpl->setCoordinateTransformation(coordTransform);
5023 }
5024
5031 {
5032 return mImpl->getCoordinateTransformation();
5033 }
5034
5046 {
5047 mImpl->setSelectorForSinglePixel(selector);
5048 }
5049
5056 {
5057 return mImpl->getSelectorForSinglePixel();
5058 }
5059
5070 {
5071 mImpl->setNearestRounding(value);
5072 }
5073
5080 {
5081 return mImpl->getNearestRounding();
5082 }
5083
5084protected:
5085 virtual ~IResizeLayer() noexcept = default;
5086 apiv::VResizeLayer* mImpl;
5087};
5088
5090enum class LoopOutput : int32_t
5091{
5093 kLAST_VALUE = 0,
5094
5096 kCONCATENATE = 1,
5097
5099 kREVERSE = 2
5100};
5101
5107template <>
5108constexpr inline int32_t EnumMax<LoopOutput>() noexcept
5109{
5110 return 3;
5111}
5112
5114enum class TripLimit : int32_t
5115{
5116
5117 kCOUNT = 0,
5118 kWHILE = 1
5119};
5120
5126template <>
5127constexpr inline int32_t EnumMax<TripLimit>() noexcept
5128{
5129 return 2;
5130}
5131
5132class ILoop;
5133
5135{
5136public:
5138 ILoop* getLoop() const noexcept
5139 {
5140 return mBoundary->getLoop();
5141 }
5142
5143protected:
5144 virtual ~ILoopBoundaryLayer() noexcept = default;
5145 apiv::VLoopBoundaryLayer* mBoundary;
5146};
5147
5154{
5155public:
5158 {
5159 return mBoundary->getConditional();
5160 }
5161
5162protected:
5163 virtual ~IIfConditionalBoundaryLayer() noexcept = default;
5164 apiv::VConditionalBoundaryLayer* mBoundary;
5165};
5166
5171{
5172public:
5173protected:
5174 virtual ~IConditionLayer() noexcept = default;
5175 apiv::VConditionLayer* mImpl;
5176};
5177
5184{
5185public:
5186protected:
5187 virtual ~IIfConditionalOutputLayer() noexcept = default;
5188 apiv::VConditionalOutputLayer* mImpl;
5189};
5190
5195{
5196public:
5197protected:
5198 virtual ~IIfConditionalInputLayer() noexcept = default;
5199 apiv::VConditionalInputLayer* mImpl;
5200};
5201
5224{
5225public:
5236 {
5237 return mImpl->setCondition(condition);
5238 }
5239
5251 IIfConditionalOutputLayer* addOutput(ITensor& trueSubgraphOutput, ITensor& falseSubgraphOutput) noexcept
5252 {
5253 return mImpl->addOutput(trueSubgraphOutput, falseSubgraphOutput);
5254 }
5255
5264 {
5265 return mImpl->addInput(input);
5266 }
5267
5276 void setName(const char* name) noexcept
5277 {
5278 mImpl->setName(name);
5279 }
5280
5286 const char* getName() const noexcept
5287 {
5288 return mImpl->getName();
5289 }
5290
5291protected:
5292 virtual ~IIfConditional() noexcept = default;
5293 apiv::VIfConditional* mImpl;
5294};
5295
5296
5298{
5299public:
5305 //
5318 using ILayer::setInput;
5319
5320protected:
5321 virtual ~IRecurrenceLayer() noexcept = default;
5322 apiv::VRecurrenceLayer* mImpl;
5323};
5324
5343{
5344public:
5345 LoopOutput getLoopOutput() const noexcept
5346 {
5347 return mImpl->getLoopOutput();
5348 }
5349
5362 void setAxis(int32_t axis) noexcept
5363 {
5364 mImpl->setAxis(axis);
5365 }
5366
5368 int32_t getAxis() const noexcept
5369 {
5370 return mImpl->getAxis();
5371 }
5372
5378 //
5393 using ILayer::setInput;
5394
5395protected:
5396 virtual ~ILoopOutputLayer() noexcept = default;
5397 apiv::VLoopOutputLayer* mImpl;
5398};
5399
5401{
5402public:
5403 TripLimit getTripLimit() const noexcept
5404 {
5405 return mImpl->getTripLimit();
5406 }
5407
5408protected:
5409 virtual ~ITripLimitLayer() noexcept = default;
5410 apiv::VTripLimitLayer* mImpl;
5411};
5412
5414{
5415public:
5417 void setAxis(int32_t axis) noexcept
5418 {
5419 mImpl->setAxis(axis);
5420 }
5421
5423 int32_t getAxis() const noexcept
5424 {
5425 return mImpl->getAxis();
5426 }
5427
5433 void setReverse(bool reverse) noexcept
5434 {
5435 mImpl->setReverse(reverse);
5436 }
5437
5439 bool getReverse() const noexcept
5440 {
5441 return mImpl->getReverse();
5442 }
5443
5444protected:
5445 virtual ~IIteratorLayer() noexcept = default;
5446 apiv::VIteratorLayer* mImpl;
5447};
5448
5454class ILoop : public INoCopy
5455{
5456public:
5463 IRecurrenceLayer* addRecurrence(ITensor& initialValue) noexcept
5464 {
5465 return mImpl->addRecurrence(initialValue);
5466 }
5467
5485 {
5486 return mImpl->addTripLimit(tensor, limit);
5487 }
5488
5497 IIteratorLayer* addIterator(ITensor& tensor, int32_t axis = 0, bool reverse = false) noexcept
5498 {
5499 return mImpl->addIterator(tensor, axis, reverse);
5500 }
5501
5509 ILoopOutputLayer* addLoopOutput(ITensor& tensor, LoopOutput outputKind, int32_t axis = 0) noexcept
5510 {
5511 return mImpl->addLoopOutput(tensor, outputKind, axis);
5512 }
5513
5522 void setName(const char* name) noexcept
5523 {
5524 mImpl->setName(name);
5525 }
5526
5532 const char* getName() const noexcept
5533 {
5534 return mImpl->getName();
5535 }
5536
5537protected:
5538 virtual ~ILoop() noexcept = default;
5539 apiv::VLoop* mImpl;
5540};
5541
5545class ISelectLayer : public ILayer
5546{
5547protected:
5548 virtual ~ISelectLayer() noexcept = default;
5549 apiv::VSelectLayer* mImpl;
5550};
5551
5567{
5568public:
5577 void setMessage(const char* message) noexcept
5578 {
5579 mImpl->setMessage(message);
5580 }
5581
5587 const char* getMessage() const noexcept
5588 {
5589 return mImpl->getMessage();
5590 }
5591
5592protected:
5593 virtual ~IAssertionLayer() noexcept = default;
5594
5595 apiv::VAssertionLayer* mImpl;
5596};
5597
5605enum class FillOperation : int32_t
5606{
5607 kLINSPACE = 0,
5608 kRANDOM_UNIFORM = 1
5609};
5610
5616template <>
5617constexpr inline int32_t EnumMax<FillOperation>() noexcept
5618{
5619 return 2;
5620}
5621
5647class IFillLayer : public ILayer
5648{
5649public:
5658 //
5659 void setDimensions(Dims dimensions) noexcept
5660 {
5661 mImpl->setDimensions(dimensions);
5662 }
5663
5674 Dims getDimensions() const noexcept
5675 {
5676 return mImpl->getDimensions();
5677 }
5678
5684 void setOperation(FillOperation op) noexcept
5685 {
5686 mImpl->setOperation(op);
5687 }
5688
5695 {
5696 return mImpl->getOperation();
5697 }
5698
5711 //
5712 void setAlpha(double alpha) noexcept
5713 {
5714 mImpl->setAlpha(alpha);
5715 }
5716
5727 double getAlpha() const noexcept
5728 {
5729 return mImpl->getAlpha();
5730 }
5731
5745 void setBeta(double beta) noexcept
5746 {
5747 mImpl->setBeta(beta);
5748 }
5749
5760 double getBeta() const noexcept
5761 {
5762 return mImpl->getBeta();
5763 }
5764
5791 using ILayer::setInput;
5792
5793protected:
5794 virtual ~IFillLayer() noexcept = default;
5795 apiv::VFillLayer* mImpl;
5796};
5797
5856{
5857public:
5866 int32_t getAxis() const noexcept
5867 {
5868 return mImpl->getAxis();
5869 }
5877 void setAxis(int32_t axis) noexcept
5878 {
5879 mImpl->setAxis(axis);
5880 }
5881
5882protected:
5883 virtual ~IQuantizeLayer() noexcept = default;
5884 apiv::VQuantizeLayer* mImpl;
5885};
5886
5943{
5944public:
5953 int32_t getAxis() const noexcept
5954 {
5955 return mImpl->getAxis();
5956 }
5964 void setAxis(int32_t axis) noexcept
5965 {
5966 mImpl->setAxis(axis);
5967 }
5968
5969protected:
5970 virtual ~IDequantizeLayer() noexcept = default;
5971 apiv::VDequantizeLayer* mImpl;
5972};
5973
6009class IEinsumLayer : public ILayer
6010{
6011public:
6021 bool setEquation(const char* equation) noexcept
6022 {
6023 return mImpl->setEquation(equation);
6024 }
6025
6031 const char* getEquation() const noexcept
6032 {
6033 return mImpl->getEquation();
6034 }
6035
6036protected:
6037 virtual ~IEinsumLayer() noexcept = default;
6038 apiv::VEinsumLayer* mImpl;
6039};
6040
6046enum class ScatterMode : int32_t
6047{
6048 kELEMENT = 0,
6049 kND = 1,
6050};
6051
6057template <>
6058constexpr inline int32_t EnumMax<ScatterMode>() noexcept
6059{
6060 return 2;
6061}
6062
6119class IScatterLayer : public ILayer
6120{
6121public:
6127 void setMode(ScatterMode mode) noexcept
6128 {
6129 mImpl->setMode(mode);
6130 }
6131
6137 ScatterMode getMode() const noexcept
6138 {
6139 return mImpl->getMode();
6140 }
6141
6147 void setAxis(int32_t axis) noexcept
6148 {
6149 mImpl->setAxis(axis);
6150 }
6151
6155 int32_t getAxis() const noexcept
6156 {
6157 return mImpl->getAxis();
6158 }
6159
6160protected:
6161 apiv::VScatterLayer* mImpl;
6162 virtual ~IScatterLayer() noexcept = default;
6163}; // class IScatterLayer
6164
6185{
6186public:
6187 virtual ~INetworkDefinition() noexcept = default;
6188
6224 ITensor* addInput(const char* name, DataType type, Dims dimensions) noexcept
6225 {
6226 return mImpl->addInput(name, type, dimensions);
6227 }
6228
6238 void markOutput(ITensor& tensor) noexcept
6239 {
6240 mImpl->markOutput(tensor);
6241 }
6242
6262 ITensor& input, int32_t nbOutputMaps, DimsHW kernelSize, Weights kernelWeights, Weights biasWeights) noexcept
6263 {
6264 return mImpl->addConvolution(input, nbOutputMaps, kernelSize, kernelWeights, biasWeights);
6265 }
6266
6285 ITensor& input, int32_t nbOutputs, Weights kernelWeights, Weights biasWeights) noexcept
6286 {
6287 return mImpl->addFullyConnected(input, nbOutputs, kernelWeights, biasWeights);
6288 }
6289
6305 {
6306 return mImpl->addActivation(input, type);
6307 }
6308
6324 {
6325 return mImpl->addPooling(input, type, windowSize);
6326 }
6327
6342 ILRNLayer* addLRN(ITensor& input, int32_t window, float alpha, float beta, float k) noexcept
6343 {
6344 return mImpl->addLRN(input, window, alpha, beta, k);
6345 }
6346
6369 IScaleLayer* addScale(ITensor& input, ScaleMode mode, Weights shift, Weights scale, Weights power) noexcept
6370 {
6371 return mImpl->addScale(input, mode, shift, scale, power);
6372 }
6373
6383 {
6384 return mImpl->addSoftMax(input);
6385 }
6386
6399 IConcatenationLayer* addConcatenation(ITensor* const* inputs, int32_t nbInputs) noexcept
6400 {
6401 return mImpl->addConcatenation(inputs, nbInputs);
6402 }
6403
6423 ITensor& input, int32_t nbOutputMaps, DimsHW kernelSize, Weights kernelWeights, Weights biasWeights) noexcept
6424 {
6425 return mImpl->addDeconvolution(input, nbOutputMaps, kernelSize, kernelWeights, biasWeights);
6426 }
6427
6451 {
6452 return mImpl->addElementWise(input1, input2, op);
6453 }
6454
6472 IUnaryLayer* addUnary(ITensor& input, UnaryOperation operation) noexcept
6473 {
6474 return mImpl->addUnary(input, operation);
6475 }
6476
6489 TRT_DEPRECATED IPaddingLayer* addPadding(ITensor& input, DimsHW prePadding, DimsHW postPadding) noexcept
6490 {
6491 return mImpl->addPadding(input, prePadding, postPadding);
6492 }
6493
6504 {
6505 return mImpl->addShuffle(input);
6506 }
6507
6515 int32_t getNbLayers() const noexcept
6516 {
6517 return mImpl->getNbLayers();
6518 }
6519
6529 ILayer* getLayer(int32_t index) const noexcept
6530 {
6531 return mImpl->getLayer(index);
6532 }
6533
6541 int32_t getNbInputs() const noexcept
6542 {
6543 return mImpl->getNbInputs();
6544 }
6545
6557 ITensor* getInput(int32_t index) const noexcept
6558 {
6559 return mImpl->getInput(index);
6560 }
6561
6571 int32_t getNbOutputs() const noexcept
6572 {
6573 return mImpl->getNbOutputs();
6574 }
6575
6587 ITensor* getOutput(int32_t index) const noexcept
6588 {
6589 return mImpl->getOutput(index);
6590 }
6591
6599 TRT_DEPRECATED void destroy() noexcept
6600 {
6601 delete this;
6602 }
6603
6627 ITensor& input, ReduceOperation operation, uint32_t reduceAxes, bool keepDimensions) noexcept
6628 {
6629 return mImpl->addReduce(input, operation, reduceAxes, keepDimensions);
6630 }
6631
6660 ITopKLayer* addTopK(ITensor& input, TopKOperation op, int32_t k, uint32_t reduceAxes) noexcept
6661 {
6662 return mImpl->addTopK(input, op, k, reduceAxes);
6663 }
6664
6676 IGatherLayer* addGather(ITensor& data, ITensor& indices, int32_t axis) noexcept
6677 {
6678 return mImpl->addGather(data, indices, axis);
6679 }
6680
6693 {
6694 return mImpl->addGatherV2(data, indices, mode);
6695 }
6696
6711 {
6712 return mImpl->addRaggedSoftMax(input, bounds);
6713 }
6714
6732 ITensor& input0, MatrixOperation op0, ITensor& input1, MatrixOperation op1) noexcept
6733 {
6734 return mImpl->addMatrixMultiply(input0, op0, input1, op1);
6735 }
6736
6757 IConstantLayer* addConstant(Dims dimensions, Weights weights) noexcept
6758 {
6759 return mImpl->addConstant(dimensions, weights);
6760 }
6761
6827 ITensor& input, int32_t layerCount, int32_t hiddenSize, int32_t maxSeqLen, RNNOperation op) noexcept
6828 {
6829 return mImpl->addRNNv2(input, layerCount, hiddenSize, maxSeqLen, op);
6830 }
6831
6842 {
6843 return mImpl->addIdentity(input);
6844 }
6845
6856 void removeTensor(ITensor& tensor) noexcept
6857 {
6858 mImpl->removeTensor(tensor);
6859 }
6860
6868 void unmarkOutput(ITensor& tensor) noexcept
6869 {
6870 mImpl->unmarkOutput(tensor);
6871 }
6872
6887 IPluginV2Layer* addPluginV2(ITensor* const* inputs, int32_t nbInputs, IPluginV2& plugin) noexcept
6888 {
6889 return mImpl->addPluginV2(inputs, nbInputs, plugin);
6890 }
6891
6906 ISliceLayer* addSlice(ITensor& input, Dims start, Dims size, Dims stride) noexcept
6907 {
6908 return mImpl->addSlice(input, start, size, stride);
6909 }
6910
6928 void setName(const char* name) noexcept
6929 {
6930 mImpl->setName(name);
6931 }
6932
6942 const char* getName() const noexcept
6943 {
6944 return mImpl->getName();
6945 }
6946
6960 IShapeLayer* addShape(ITensor& input) noexcept
6961 {
6962 return mImpl->addShape(input);
6963 }
6964
6979 bool hasImplicitBatchDimension() const noexcept
6980 {
6981 return mImpl->hasImplicitBatchDimension();
6982 }
6983
6997 bool markOutputForShapes(ITensor& tensor) noexcept
6998 {
6999 return mImpl->markOutputForShapes(tensor);
7000 }
7001
7009 bool unmarkOutputForShapes(ITensor& tensor) noexcept
7010 {
7011 return mImpl->unmarkOutputForShapes(tensor);
7012 }
7013
7028 {
7029 return mImpl->addParametricReLU(input, slope);
7030 }
7031
7050 ITensor& input, int32_t nbOutputMaps, Dims kernelSize, Weights kernelWeights, Weights biasWeights) noexcept
7051 {
7052 return mImpl->addConvolutionNd(input, nbOutputMaps, kernelSize, kernelWeights, biasWeights);
7053 }
7054
7069 IPoolingLayer* addPoolingNd(ITensor& input, PoolingType type, Dims windowSize) noexcept
7070 {
7071 return mImpl->addPoolingNd(input, type, windowSize);
7072 }
7073
7088 //
7092 ITensor& input, int32_t nbOutputMaps, Dims kernelSize, Weights kernelWeights, Weights biasWeights) noexcept
7093 {
7094 return mImpl->addDeconvolutionNd(input, nbOutputMaps, kernelSize, kernelWeights, biasWeights);
7095 }
7096
7128 ITensor& input, ScaleMode mode, Weights shift, Weights scale, Weights power, int32_t channelAxis) noexcept
7129 {
7130 return mImpl->addScaleNd(input, mode, shift, scale, power, channelAxis);
7131 }
7132
7144 {
7145 return mImpl->addResize(input);
7146 }
7147
7161 {
7162 return mImpl->hasExplicitPrecision();
7163 }
7164
7176 ILoop* addLoop() noexcept
7177 {
7178 return mImpl->addLoop();
7179 }
7180
7216 ISelectLayer* addSelect(ITensor& condition, ITensor& thenInput, ITensor& elseInput) noexcept
7217 {
7218 return mImpl->addSelect(condition, thenInput, elseInput);
7219 }
7220
7233 IAssertionLayer* addAssertion(ITensor& condition, const char* message) noexcept
7234 {
7235 return mImpl->addAssertion(condition, message);
7236 }
7237
7251 IFillLayer* addFill(Dims dimensions, FillOperation op) noexcept
7252 {
7253 return mImpl->addFill(dimensions, op);
7254 }
7255
7268 TRT_DEPRECATED IPaddingLayer* addPaddingNd(ITensor& input, Dims prePadding, Dims postPadding) noexcept
7269 {
7270 return mImpl->addPaddingNd(input, prePadding, postPadding);
7271 }
7272
7288 bool setWeightsName(Weights weights, const char* name) noexcept
7289 {
7290 return mImpl->setWeightsName(weights, name);
7291 }
7292
7304 //
7307 void setErrorRecorder(IErrorRecorder* recorder) noexcept
7308 {
7309 mImpl->setErrorRecorder(recorder);
7310 }
7311
7323 {
7324 return mImpl->getErrorRecorder();
7325 }
7326
7342 {
7343 return mImpl->addDequantize(input, scale);
7344 }
7345
7361 IScatterLayer* addScatter(ITensor& data, ITensor& indices, ITensor& updates, ScatterMode mode) noexcept
7362 {
7363 return mImpl->addScatter(data, indices, updates, mode);
7364 }
7365
7380 IQuantizeLayer* addQuantize(ITensor& input, ITensor& scale) noexcept
7381 {
7382 return mImpl->addQuantize(input, scale);
7383 }
7384
7396 {
7397 return mImpl->addIfConditional();
7398 }
7399
7409 IEinsumLayer* addEinsum(ITensor* const* inputs, int32_t nbInputs, const char* equation) noexcept
7410 {
7411 return mImpl->addEinsum(inputs, nbInputs, equation);
7412 }
7413
7414protected:
7415 apiv::VNetworkDefinition* mImpl;
7416};
7417
7423enum class CalibrationAlgoType : int32_t
7424{
7429};
7430
7436template <>
7437constexpr inline int32_t EnumMax<CalibrationAlgoType>() noexcept
7438{
7439 return 4;
7440}
7441
7454{
7455public:
7461 virtual int32_t getBatchSize() const noexcept = 0;
7462
7476 virtual bool getBatch(void* bindings[], const char* names[], int32_t nbBindings) noexcept = 0;
7477
7492 virtual const void* readCalibrationCache(std::size_t& length) noexcept = 0;
7493
7502 virtual void writeCalibrationCache(const void* ptr, std::size_t length) noexcept = 0;
7503
7509 virtual CalibrationAlgoType getAlgorithm() noexcept = 0;
7510
7511 virtual ~IInt8Calibrator() noexcept = default;
7512};
7513
7519{
7520public:
7525 {
7527 }
7528
7529 virtual ~IInt8EntropyCalibrator() noexcept = default;
7530};
7531
7537{
7538public:
7543 {
7545 }
7546
7547 virtual ~IInt8EntropyCalibrator2() noexcept = default;
7548};
7549
7554{
7555public:
7560 {
7562 }
7563
7564 virtual ~IInt8MinMaxCalibrator() noexcept = default;
7565};
7566
7572{
7573public:
7578 {
7580 }
7581
7588 virtual double getQuantile() const noexcept = 0;
7589
7596 virtual double getRegressionCutoff() const noexcept = 0;
7597
7610 virtual const void* readHistogramCache(std::size_t& length) noexcept = 0;
7611
7620 virtual void writeHistogramCache(const void* ptr, std::size_t length) noexcept = 0;
7621
7622 virtual ~IInt8LegacyCalibrator() noexcept = default;
7623};
7624
7636{
7637public:
7642 {
7643 return mImpl->getTensorFormat();
7644 }
7645
7649 DataType getDataType() const noexcept
7650 {
7651 return mImpl->getDataType();
7652 }
7653
7657 Dims getStrides() const noexcept
7658 {
7659 return mImpl->getStrides();
7660 }
7661
7662protected:
7663 virtual ~IAlgorithmIOInfo() noexcept = default;
7664 apiv::VAlgorithmIOInfo* mImpl;
7665};
7666
7679{
7680public:
7684 int64_t getImplementation() const noexcept
7685 {
7686 return mImpl->getImplementation();
7687 }
7688
7692 int64_t getTactic() const noexcept
7693 {
7694 return mImpl->getTactic();
7695 }
7696
7697protected:
7698 virtual ~IAlgorithmVariant() noexcept = default;
7699 apiv::VAlgorithmVariant* mImpl;
7700};
7701
7711{
7712public:
7717 const char* getName() const noexcept
7718 {
7719 return mImpl->getName();
7720 }
7721
7728 Dims getDimensions(int32_t index, OptProfileSelector select) const noexcept
7729 {
7730 return mImpl->getDimensions(index, select);
7731 }
7732
7736 int32_t getNbInputs() const noexcept
7737 {
7738 return mImpl->getNbInputs();
7739 }
7740
7744 int32_t getNbOutputs() const noexcept
7745 {
7746 return mImpl->getNbOutputs();
7747 }
7748
7749protected:
7750 virtual ~IAlgorithmContext() noexcept = default;
7751 apiv::VAlgorithmContext* mImpl;
7752};
7753
7763class IAlgorithm : public INoCopy
7764{
7765public:
7776 TRT_DEPRECATED const IAlgorithmIOInfo& getAlgorithmIOInfo(int32_t index) const noexcept
7777 {
7778 return mImpl->getAlgorithmIOInfo(index);
7779 }
7780
7785 {
7786 return mImpl->getAlgorithmVariant();
7787 }
7788
7792 float getTimingMSec() const noexcept
7793 {
7794 return mImpl->getTimingMSec();
7795 }
7796
7800 std::size_t getWorkspaceSize() const noexcept
7801 {
7802 return mImpl->getWorkspaceSize();
7803 }
7804
7813 const IAlgorithmIOInfo* getAlgorithmIOInfoByIndex(int32_t index) const noexcept
7814 {
7815 return mImpl->getAlgorithmIOInfoByIndex(index);
7816 }
7817
7818protected:
7819 virtual ~IAlgorithm() noexcept = default;
7820 apiv::VAlgorithm* mImpl;
7821}; // IAlgorithm
7822
7832{
7833public:
7848 virtual int32_t selectAlgorithms(const IAlgorithmContext& context, const IAlgorithm* const* choices,
7849 int32_t nbChoices, int32_t* selection) noexcept
7850 = 0;
7861 virtual void reportAlgorithms(const IAlgorithmContext* const* algoContexts, const IAlgorithm* const* algoChoices,
7862 int32_t nbAlgorithms) noexcept
7863 = 0;
7864
7865 virtual ~IAlgorithmSelector() noexcept = default;
7866};
7867
7874using QuantizationFlags = uint32_t;
7875
7883enum class QuantizationFlag : int32_t
7884{
7889};
7890
7896template <>
7897constexpr inline int32_t EnumMax<QuantizationFlag>() noexcept
7898{
7899 return 1;
7900}
7901
7908using BuilderFlags = uint32_t;
7909
7917enum class BuilderFlag : int32_t
7918{
7919 kFP16 = 0,
7920 kINT8 = 1,
7921 kDEBUG = 2,
7922 kGPU_FALLBACK = 3,
7923
7935
7936 kREFIT = 5,
7938
7942 kTF32 = 7,
7943
7945 kSPARSE_WEIGHTS = 8,
7946
7953 kSAFETY_SCOPE = 9,
7954
7957
7961
7965 kDIRECT_IO = 12,
7966
7969};
7970
7976template <>
7977constexpr inline int32_t EnumMax<BuilderFlag>() noexcept
7978{
7979 return 14;
7980}
7981
7992class ITimingCache : public INoCopy
7993{
7994public:
7995 virtual ~ITimingCache() noexcept = default;
7996
8006 nvinfer1::IHostMemory* serialize() const noexcept
8007 {
8008 return mImpl->serialize();
8009 }
8010
8030 bool combine(const ITimingCache& inputCache, bool ignoreMismatch) noexcept
8031 {
8032 return mImpl->combine(inputCache, ignoreMismatch);
8033 }
8034
8040 bool reset() noexcept
8041 {
8042 return mImpl->reset();
8043 }
8044
8045protected:
8046 apiv::VTimingCache* mImpl;
8047};
8048
8056enum class MemoryPoolType : int32_t
8057{
8065 kWORKSPACE = 0,
8066
8074
8080 kDLA_LOCAL_DRAM = 2,
8081
8087 kDLA_GLOBAL_DRAM = 3,
8088};
8089
8095template <>
8096constexpr inline int32_t EnumMax<MemoryPoolType>() noexcept
8097{
8098 return 4;
8099}
8100
8109{
8110public:
8111 virtual ~IBuilderConfig() noexcept = default;
8112
8123 virtual void setMinTimingIterations(int32_t minTiming) noexcept
8124 {
8125 mImpl->setMinTimingIterations(minTiming);
8126 }
8127
8135 virtual int32_t getMinTimingIterations() const noexcept
8136 {
8137 return mImpl->getMinTimingIterations();
8138 }
8139
8148 virtual void setAvgTimingIterations(int32_t avgTiming) noexcept
8149 {
8150 mImpl->setAvgTimingIterations(avgTiming);
8151 }
8152
8160 int32_t getAvgTimingIterations() const noexcept
8161 {
8162 return mImpl->getAvgTimingIterations();
8163 }
8164
8173 void setEngineCapability(EngineCapability capability) noexcept
8174 {
8175 mImpl->setEngineCapability(capability);
8176 }
8177
8186 {
8187 return mImpl->getEngineCapability();
8188 }
8189
8195 void setInt8Calibrator(IInt8Calibrator* calibrator) noexcept
8196 {
8197 mImpl->setInt8Calibrator(calibrator);
8198 }
8199
8204 {
8205 return mImpl->getInt8Calibrator();
8206 }
8207
8218 TRT_DEPRECATED void setMaxWorkspaceSize(std::size_t workspaceSize) noexcept
8219 {
8220 mImpl->setMaxWorkspaceSize(workspaceSize);
8221 }
8222
8235 TRT_DEPRECATED std::size_t getMaxWorkspaceSize() const noexcept
8236 {
8237 return mImpl->getMaxWorkspaceSize();
8238 }
8239
8252 void setFlags(BuilderFlags builderFlags) noexcept
8253 {
8254 mImpl->setFlags(builderFlags);
8255 }
8256
8264 BuilderFlags getFlags() const noexcept
8265 {
8266 return mImpl->getFlags();
8267 }
8268
8276 void clearFlag(BuilderFlag builderFlag) noexcept
8277 {
8278 mImpl->clearFlag(builderFlag);
8279 }
8280
8288 void setFlag(BuilderFlag builderFlag) noexcept
8289 {
8290 mImpl->setFlag(builderFlag);
8291 }
8292
8300 bool getFlag(BuilderFlag builderFlag) const noexcept
8301 {
8302 return mImpl->getFlag(builderFlag);
8303 }
8304
8315 void setDeviceType(const ILayer* layer, DeviceType deviceType) noexcept
8316 {
8317 mImpl->setDeviceType(layer, deviceType);
8318 }
8319
8324 DeviceType getDeviceType(const ILayer* layer) const noexcept
8325 {
8326 return mImpl->getDeviceType(layer);
8327 }
8328
8334 bool isDeviceTypeSet(const ILayer* layer) const noexcept
8335 {
8336 return mImpl->isDeviceTypeSet(layer);
8337 }
8338
8344 void resetDeviceType(const ILayer* layer) noexcept
8345 {
8346 mImpl->resetDeviceType(layer);
8347 }
8348
8353 bool canRunOnDLA(const ILayer* layer) const noexcept
8354 {
8355 return mImpl->canRunOnDLA(layer);
8356 }
8357
8368 void setDLACore(int32_t dlaCore) noexcept
8369 {
8370 mImpl->setDLACore(dlaCore);
8371 }
8372
8379 int32_t getDLACore() const noexcept
8380 {
8381 return mImpl->getDLACore();
8382 }
8383
8389 void setDefaultDeviceType(DeviceType deviceType) noexcept
8390 {
8391 mImpl->setDefaultDeviceType(deviceType);
8392 }
8393
8400 {
8401 return mImpl->getDefaultDeviceType();
8402 }
8403
8409 void reset() noexcept
8410 {
8411 mImpl->reset();
8412 }
8413
8423 TRT_DEPRECATED void destroy() noexcept
8424 {
8425 delete this;
8426 }
8427
8435 void setProfileStream(const cudaStream_t stream) noexcept
8436 {
8437 return mImpl->setProfileStream(stream);
8438 }
8439
8447 cudaStream_t getProfileStream() const noexcept
8448 {
8449 return mImpl->getProfileStream();
8450 }
8451
8463 int32_t addOptimizationProfile(const IOptimizationProfile* profile) noexcept
8464 {
8465 return mImpl->addOptimizationProfile(profile);
8466 }
8467
8476 int32_t getNbOptimizationProfiles() const noexcept
8477 {
8478 return mImpl->getNbOptimizationProfiles();
8479 }
8480
8489 {
8490 mImpl->setProfilingVerbosity(verbosity);
8491 }
8492
8502 {
8503 return mImpl->getProfilingVerbosity();
8504 }
8505
8511 {
8512 mImpl->setAlgorithmSelector(selector);
8513 }
8514
8519 {
8520 return mImpl->getAlgorithmSelector();
8521 }
8522
8533 bool setCalibrationProfile(const IOptimizationProfile* profile) noexcept
8534 {
8535 return mImpl->setCalibrationProfile(profile);
8536 }
8537
8544 {
8545 return mImpl->getCalibrationProfile();
8546 }
8547
8561 {
8562 mImpl->setQuantizationFlags(flags);
8563 }
8564
8573 {
8574 return mImpl->getQuantizationFlags();
8575 }
8576
8585 {
8586 mImpl->clearQuantizationFlag(flag);
8587 }
8588
8597 {
8598 mImpl->setQuantizationFlag(flag);
8599 }
8600
8608 bool getQuantizationFlag(QuantizationFlag flag) const noexcept
8609 {
8610 return mImpl->getQuantizationFlag(flag);
8611 }
8612
8633 bool setTacticSources(TacticSources tacticSources) noexcept
8634 {
8635 return mImpl->setTacticSources(tacticSources);
8636 }
8637
8649 {
8650 return mImpl->getTacticSources();
8651 }
8652
8667 nvinfer1::ITimingCache* createTimingCache(const void* blob, std::size_t size) const noexcept
8668 {
8669 return mImpl->createTimingCache(blob, size);
8670 }
8671
8690 bool setTimingCache(const ITimingCache& cache, bool ignoreMismatch) noexcept
8691 {
8692 return mImpl->setTimingCache(cache, ignoreMismatch);
8693 }
8694
8701 {
8702 return mImpl->getTimingCache();
8703 }
8704
8732 void setMemoryPoolLimit(MemoryPoolType pool, std::size_t poolSize) noexcept
8733 {
8734 mImpl->setMemoryPoolLimit(pool, poolSize);
8735 }
8736
8751 std::size_t getMemoryPoolLimit(MemoryPoolType pool) const noexcept
8752 {
8753 return mImpl->getMemoryPoolLimit(pool);
8754 }
8755
8756protected:
8757 apiv::VBuilderConfig* mImpl;
8758};
8759
8767
8778{
8784 kEXPLICIT_BATCH = 0,
8785
8799};
8800
8806template <>
8807constexpr inline int32_t EnumMax<NetworkDefinitionCreationFlag>() noexcept
8808{
8809 return 2;
8810}
8811
8819class IBuilder : public INoCopy
8820{
8821public:
8822 virtual ~IBuilder() noexcept = default;
8823
8832 void setMaxBatchSize(int32_t batchSize) noexcept
8833 {
8834 mImpl->setMaxBatchSize(batchSize);
8835 }
8836
8845 int32_t getMaxBatchSize() const noexcept
8846 {
8847 return mImpl->getMaxBatchSize();
8848 }
8849
8853 bool platformHasFastFp16() const noexcept
8854 {
8855 return mImpl->platformHasFastFp16();
8856 }
8857
8861 bool platformHasFastInt8() const noexcept
8862 {
8863 return mImpl->platformHasFastInt8();
8864 }
8865
8873 TRT_DEPRECATED void destroy() noexcept
8874 {
8875 delete this;
8876 }
8877
8885 int32_t getMaxDLABatchSize() const noexcept
8886 {
8887 return mImpl->getMaxDLABatchSize();
8888 }
8889
8893 int32_t getNbDLACores() const noexcept
8894 {
8895 return mImpl->getNbDLACores();
8896 }
8897
8909 void setGpuAllocator(IGpuAllocator* allocator) noexcept
8910 {
8911 mImpl->setGpuAllocator(allocator);
8912 }
8913
8920 {
8921 return mImpl->createBuilderConfig();
8922 }
8923
8935 INetworkDefinition& network, IBuilderConfig& config) noexcept
8936 {
8937 return mImpl->buildEngineWithConfig(network, config);
8938 }
8939
8952 {
8953 return mImpl->createNetworkV2(flags);
8954 }
8955
8966 {
8967 return mImpl->createOptimizationProfile();
8968 }
8969
8981 //
8984 void setErrorRecorder(IErrorRecorder* recorder) noexcept
8985 {
8986 mImpl->setErrorRecorder(recorder);
8987 }
8988
9000 {
9001 return mImpl->getErrorRecorder();
9002 }
9003
9007 void reset() noexcept
9008 {
9009 mImpl->reset();
9010 }
9011
9015 bool platformHasTf32() const noexcept
9016 {
9017 return mImpl->platformHasTf32();
9018 }
9019
9035 {
9036 return mImpl->buildSerializedNetwork(network, config);
9037 }
9038
9058 bool isNetworkSupported(INetworkDefinition const& network, IBuilderConfig const& config) const noexcept
9059 {
9060 return mImpl->isNetworkSupported(network, config);
9061 }
9062
9068 ILogger* getLogger() const noexcept
9069 {
9070 return mImpl->getLogger();
9071 }
9072
9082 bool setMaxThreads(int32_t maxThreads) noexcept
9083 {
9084 return mImpl->setMaxThreads(maxThreads);
9085 }
9086
9096 int32_t getMaxThreads() const noexcept
9097 {
9098 return mImpl->getMaxThreads();
9099 }
9100
9101protected:
9102 apiv::VBuilder* mImpl;
9103};
9104
9105} // namespace nvinfer1
9106
9111extern "C" TENSORRTAPI void* createInferBuilder_INTERNAL(void* logger, int32_t version) noexcept;
9112
9113namespace nvinfer1
9114{
9115namespace
9116{
9117
9125inline IBuilder* createInferBuilder(ILogger& logger) noexcept
9126{
9127 return static_cast<IBuilder*>(createInferBuilder_INTERNAL(&logger, NV_TENSORRT_VERSION));
9128}
9129
9130} // namespace
9131
9143 nvinfer1::EngineCapability capability) noexcept;
9144
9145} // namespace nvinfer1
9146
9147#endif // NV_INFER_H
#define TENSORRTAPI
Definition: NvInferRuntimeCommon.h:91
#define NV_TENSORRT_VERSION
Definition: NvInferRuntimeCommon.h:110
#define TRT_DEPRECATED
Definition: NvInferRuntimeCommon.h:77
#define TRT_DEPRECATED_ENUM
Definition: NvInferRuntimeCommon.h:78
Definition: NvInferRuntimeCommon.h:190
static constexpr int32_t MAX_DIMS
The maximum rank (number of dimensions) supported for a tensor.
Definition: NvInferRuntimeCommon.h:193
Descriptor for two-dimensional spatial data.
Definition: NvInferLegacyDims.h:101
An Activation layer in a network definition.
Definition: NvInfer.h:1589
void setBeta(float beta) noexcept
Set the beta parameter (must be finite).
Definition: NvInfer.h:1637
void setActivationType(ActivationType type) noexcept
Set the type of activation to be performed.
Definition: NvInfer.h:1598
ActivationType getActivationType() const noexcept
Get the type of activation to be performed.
Definition: NvInfer.h:1608
float getAlpha() const noexcept
Get the alpha parameter.
Definition: NvInfer.h:1646
virtual ~IActivationLayer() noexcept=default
float getBeta() const noexcept
Get the beta parameter.
Definition: NvInfer.h:1655
void setAlpha(float alpha) noexcept
Set the alpha parameter (must be finite).
Definition: NvInfer.h:1623
Describes the context and requirements, that could be fulfilled by one or more instances of IAlgorith...
Definition: NvInfer.h:7711
const char * getName() const noexcept
Return name of the algorithm node. This is a unique identifier for the IAlgorithmContext.
Definition: NvInfer.h:7717
int32_t getNbOutputs() const noexcept
Return number of outputs of the algorithm.
Definition: NvInfer.h:7744
int32_t getNbInputs() const noexcept
Return number of inputs of the algorithm.
Definition: NvInfer.h:7736
virtual ~IAlgorithmContext() noexcept=default
Dims getDimensions(int32_t index, OptProfileSelector select) const noexcept
Get the minimum / optimum / maximum dimensions for input or output tensor.
Definition: NvInfer.h:7728
Describes a variation of execution of a layer. An algorithm is represented by IAlgorithmVariant and t...
Definition: NvInfer.h:7764
std::size_t getWorkspaceSize() const noexcept
The size of the GPU temporary memory in bytes which the algorithm uses at execution time.
Definition: NvInfer.h:7800
float getTimingMSec() const noexcept
The time in milliseconds to execute the algorithm.
Definition: NvInfer.h:7792
virtual ~IAlgorithm() noexcept=default
TRT_DEPRECATED const IAlgorithmIOInfo & getAlgorithmIOInfo(int32_t index) const noexcept
Returns the format of an Algorithm input or output. Algorithm inputs are incrementally numbered first...
Definition: NvInfer.h:7776
const IAlgorithmVariant & getAlgorithmVariant() const noexcept
Returns the algorithm variant.
Definition: NvInfer.h:7784
const IAlgorithmIOInfo * getAlgorithmIOInfoByIndex(int32_t index) const noexcept
Returns the format of an Algorithm input or output. Algorithm inputs are incrementally numbered first...
Definition: NvInfer.h:7813
Carries information about input or output of the algorithm. IAlgorithmIOInfo for all the input and ou...
Definition: NvInfer.h:7636
virtual ~IAlgorithmIOInfo() noexcept=default
Dims getStrides() const noexcept
Return strides of the input/output tensor of algorithm.
Definition: NvInfer.h:7657
DataType getDataType() const noexcept
Return DataType of the input/output of algorithm.
Definition: NvInfer.h:7649
TensorFormat getTensorFormat() const noexcept
Return TensorFormat of the input/output of algorithm.
Definition: NvInfer.h:7641
Interface implemented by application for selecting and reporting algorithms of a layer provided by th...
Definition: NvInfer.h:7832
virtual int32_t selectAlgorithms(const IAlgorithmContext &context, const IAlgorithm *const *choices, int32_t nbChoices, int32_t *selection) noexcept=0
Select Algorithms for a layer from the given list of algorithm choices.
virtual void reportAlgorithms(const IAlgorithmContext *const *algoContexts, const IAlgorithm *const *algoChoices, int32_t nbAlgorithms) noexcept=0
Called by TensorRT to report choices it made.
virtual ~IAlgorithmSelector() noexcept=default
provides a unique 128-bit identifier, which along with the input and output information denotes the v...
Definition: NvInfer.h:7679
virtual ~IAlgorithmVariant() noexcept=default
int64_t getTactic() const noexcept
Return tactic of the algorithm.
Definition: NvInfer.h:7692
int64_t getImplementation() const noexcept
Return implementation of the algorithm.
Definition: NvInfer.h:7684
An assertion layer in a network.
Definition: NvInfer.h:5567
void setMessage(const char *message) noexcept
Set the message to print if the assertion fails.
Definition: NvInfer.h:5577
virtual ~IAssertionLayer() noexcept=default
const char * getMessage() const noexcept
Return the assertion message.
Definition: NvInfer.h:5587
Holds properties for configuring a builder to produce an engine.
Definition: NvInfer.h:8109
DeviceType getDeviceType(const ILayer *layer) const noexcept
Get the device that this layer executes on.
Definition: NvInfer.h:8324
void setMemoryPoolLimit(MemoryPoolType pool, std::size_t poolSize) noexcept
Set the memory size for the memory pool.
Definition: NvInfer.h:8732
void setQuantizationFlag(QuantizationFlag flag) noexcept
Set a single quantization flag.
Definition: NvInfer.h:8596
const IOptimizationProfile * getCalibrationProfile() noexcept
Get the current calibration profile.
Definition: NvInfer.h:8543
void setInt8Calibrator(IInt8Calibrator *calibrator) noexcept
Set Int8 Calibration interface.
Definition: NvInfer.h:8195
void clearQuantizationFlag(QuantizationFlag flag) noexcept
clear a quantization flag.
Definition: NvInfer.h:8584
void setDeviceType(const ILayer *layer, DeviceType deviceType) noexcept
Set the device that this layer must execute on.
Definition: NvInfer.h:8315
bool setTacticSources(TacticSources tacticSources) noexcept
Set tactic sources.
Definition: NvInfer.h:8633
bool getQuantizationFlag(QuantizationFlag flag) const noexcept
Returns true if the quantization flag is set.
Definition: NvInfer.h:8608
std::size_t getMemoryPoolLimit(MemoryPoolType pool) const noexcept
Get the memory size limit of the memory pool.
Definition: NvInfer.h:8751
int32_t getDLACore() const noexcept
Get the DLA core that the engine executes on.
Definition: NvInfer.h:8379
void setEngineCapability(EngineCapability capability) noexcept
Configure the builder to target specified EngineCapability flow.
Definition: NvInfer.h:8173
bool getFlag(BuilderFlag builderFlag) const noexcept
Returns true if the build mode flag is set.
Definition: NvInfer.h:8300
void setQuantizationFlags(QuantizationFlags flags) noexcept
Set the quantization flags.
Definition: NvInfer.h:8560
virtual void setAvgTimingIterations(int32_t avgTiming) noexcept
Set the number of averaging iterations used when timing layers.
Definition: NvInfer.h:8148
void setProfilingVerbosity(ProfilingVerbosity verbosity) noexcept
Set verbosity level of layer information exposed in NVTX annotations and IEngineInspector.
Definition: NvInfer.h:8488
nvinfer1::ITimingCache * createTimingCache(const void *blob, std::size_t size) const noexcept
Create timing cache.
Definition: NvInfer.h:8667
IAlgorithmSelector * getAlgorithmSelector() const noexcept
Get Algorithm Selector.
Definition: NvInfer.h:8518
int32_t getNbOptimizationProfiles() const noexcept
Get number of optimization profiles.
Definition: NvInfer.h:8476
QuantizationFlags getQuantizationFlags() const noexcept
Get the quantization flags.
Definition: NvInfer.h:8572
bool setCalibrationProfile(const IOptimizationProfile *profile) noexcept
Add a calibration profile.
Definition: NvInfer.h:8533
virtual int32_t getMinTimingIterations() const noexcept
Query the number of minimization iterations.
Definition: NvInfer.h:8135
void reset() noexcept
Resets the builder configuration to defaults.
Definition: NvInfer.h:8409
TRT_DEPRECATED void destroy() noexcept
Delete this IBuilderConfig.
Definition: NvInfer.h:8423
EngineCapability getEngineCapability() const noexcept
Query EngineCapability flow configured for the builder.
Definition: NvInfer.h:8185
void setAlgorithmSelector(IAlgorithmSelector *selector) noexcept
Set Algorithm Selector.
Definition: NvInfer.h:8510
TRT_DEPRECATED void setMaxWorkspaceSize(std::size_t workspaceSize) noexcept
Set the maximum workspace size.
Definition: NvInfer.h:8218
TRT_DEPRECATED std::size_t getMaxWorkspaceSize() const noexcept
Get the maximum workspace size.
Definition: NvInfer.h:8235
DeviceType getDefaultDeviceType() const noexcept
Get the default DeviceType which was set by setDefaultDeviceType.
Definition: NvInfer.h:8399
BuilderFlags getFlags() const noexcept
Get the build mode flags for this builder config. Defaults to 0.
Definition: NvInfer.h:8264
void setFlags(BuilderFlags builderFlags) noexcept
Set the build mode flags to turn on builder options for this network.
Definition: NvInfer.h:8252
TacticSources getTacticSources() const noexcept
Get tactic sources.
Definition: NvInfer.h:8648
bool setTimingCache(const ITimingCache &cache, bool ignoreMismatch) noexcept
Attach a timing cache to IBuilderConfig.
Definition: NvInfer.h:8690
bool canRunOnDLA(const ILayer *layer) const noexcept
Checks if a layer can run on DLA.
Definition: NvInfer.h:8353
void setDLACore(int32_t dlaCore) noexcept
Sets the DLA core used by the network.
Definition: NvInfer.h:8368
int32_t addOptimizationProfile(const IOptimizationProfile *profile) noexcept
Add an optimization profile.
Definition: NvInfer.h:8463
const nvinfer1::ITimingCache * getTimingCache() const noexcept
Get the pointer to the timing cache from current IBuilderConfig.
Definition: NvInfer.h:8700
bool isDeviceTypeSet(const ILayer *layer) const noexcept
whether the DeviceType has been explicitly set for this layer
Definition: NvInfer.h:8334
void clearFlag(BuilderFlag builderFlag) noexcept
clear a single build mode flag.
Definition: NvInfer.h:8276
apiv::VBuilderConfig * mImpl
Definition: NvInfer.h:8757
int32_t getAvgTimingIterations() const noexcept
Query the number of averaging iterations.
Definition: NvInfer.h:8160
void setDefaultDeviceType(DeviceType deviceType) noexcept
Sets the default DeviceType to be used by the builder. It ensures that all the layers that can run on...
Definition: NvInfer.h:8389
void setFlag(BuilderFlag builderFlag) noexcept
Set a single build mode flag.
Definition: NvInfer.h:8288
virtual ~IBuilderConfig() noexcept=default
cudaStream_t getProfileStream() const noexcept
Get the cuda stream that is used to profile this network.
Definition: NvInfer.h:8447
IInt8Calibrator * getInt8Calibrator() const noexcept
Get Int8 Calibration interface.
Definition: NvInfer.h:8203
ProfilingVerbosity getProfilingVerbosity() const noexcept
Get verbosity level of layer information exposed in NVTX annotations and IEngineInspector.
Definition: NvInfer.h:8501
void resetDeviceType(const ILayer *layer) noexcept
reset the DeviceType for this layer
Definition: NvInfer.h:8344
void setProfileStream(const cudaStream_t stream) noexcept
Set the cuda stream that is used to profile this network.
Definition: NvInfer.h:8435
Builds an engine from a network definition.
Definition: NvInfer.h:8820
int32_t getMaxDLABatchSize() const noexcept
Get the maximum batch size DLA can support. For any tensor the total volume of index dimensions combi...
Definition: NvInfer.h:8885
int32_t getNbDLACores() const noexcept
Return the number of DLA engines available to this builder.
Definition: NvInfer.h:8893
IErrorRecorder * getErrorRecorder() const noexcept
get the ErrorRecorder assigned to this interface.
Definition: NvInfer.h:8999
apiv::VBuilder * mImpl
Definition: NvInfer.h:9102
ILogger * getLogger() const noexcept
get the logger with which the builder was created
Definition: NvInfer.h:9068
bool isNetworkSupported(INetworkDefinition const &network, IBuilderConfig const &config) const noexcept
Checks that a network is within the scope of the IBuilderConfig settings.
Definition: NvInfer.h:9058
bool platformHasTf32() const noexcept
Determine whether the platform has TF32 support.
Definition: NvInfer.h:9015
int32_t getMaxThreads() const noexcept
get the maximum number of threads that can be used by the builder.
Definition: NvInfer.h:9096
TRT_DEPRECATED void destroy() noexcept
Destroy this object.
Definition: NvInfer.h:8873
int32_t getMaxBatchSize() const noexcept
Get the maximum batch size.
Definition: NvInfer.h:8845
nvinfer1::IOptimizationProfile * createOptimizationProfile() noexcept
Create a new optimization profile.
Definition: NvInfer.h:8965
bool platformHasFastFp16() const noexcept
Determine whether the platform has fast native fp16.
Definition: NvInfer.h:8853
void setGpuAllocator(IGpuAllocator *allocator) noexcept
Set the GPU allocator.
Definition: NvInfer.h:8909
nvinfer1::INetworkDefinition * createNetworkV2(NetworkDefinitionCreationFlags flags) noexcept
Create a network definition object.
Definition: NvInfer.h:8951
nvinfer1::IBuilderConfig * createBuilderConfig() noexcept
Create a builder configuration object.
Definition: NvInfer.h:8919
void reset() noexcept
Resets the builder state to default values.
Definition: NvInfer.h:9007
bool setMaxThreads(int32_t maxThreads) noexcept
Set the maximum number of threads.
Definition: NvInfer.h:9082
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInfer.h:8984
bool platformHasFastInt8() const noexcept
Determine whether the platform has fast native int8.
Definition: NvInfer.h:8861
nvinfer1::IHostMemory * buildSerializedNetwork(INetworkDefinition &network, IBuilderConfig &config) noexcept
Builds and serializes a network for the given INetworkDefinition and IBuilderConfig.
Definition: NvInfer.h:9034
virtual ~IBuilder() noexcept=default
TRT_DEPRECATED nvinfer1::ICudaEngine * buildEngineWithConfig(INetworkDefinition &network, IBuilderConfig &config) noexcept
Builds an engine for the given INetworkDefinition and given IBuilderConfig.
Definition: NvInfer.h:8934
A concatenation layer in a network definition.
Definition: NvInfer.h:2392
void setAxis(int32_t axis) noexcept
Set the axis along which concatenation occurs.
Definition: NvInfer.h:2404
int32_t getAxis() const noexcept
Get the axis along which concatenation occurs.
Definition: NvInfer.h:2414
virtual ~IConcatenationLayer() noexcept=default
Definition: NvInfer.h:5171
virtual ~IConditionLayer() noexcept=default
Layer that represents a constant value.
Definition: NvInfer.h:4603
void setWeights(Weights weights) noexcept
Set the weights for the layer.
Definition: NvInfer.h:4614
Weights getWeights() const noexcept
Get the weights for the layer.
Definition: NvInfer.h:4624
apiv::VConstantLayer * mImpl
Definition: NvInfer.h:4654
void setDimensions(Dims dimensions) noexcept
Set the dimensions for the layer.
Definition: NvInfer.h:4636
virtual ~IConstantLayer() noexcept=default
Dims getDimensions() const noexcept
Get the dimensions for the layer.
Definition: NvInfer.h:4648
A convolution layer in a network definition.
Definition: NvInfer.h:1024
TRT_DEPRECATED DimsHW getPadding() const noexcept
Get the padding of the convolution. If the padding is asymmetric, the pre-padding is returned.
Definition: NvInfer.h:1127
TRT_DEPRECATED DimsHW getStride() const noexcept
Get the stride of the convolution.
Definition: NvInfer.h:1095
TRT_DEPRECATED DimsHW getDilation() const noexcept
Get the dilation for a convolution.
Definition: NvInfer.h:1234
void setStrideNd(Dims stride) noexcept
Set the multi-dimension stride of the convolution.
Definition: NvInfer.h:1352
void setKernelSizeNd(Dims kernelSize) noexcept
Set the multi-dimension kernel size of the convolution.
Definition: NvInfer.h:1327
Dims getPrePadding() const noexcept
Get the pre-padding.
Definition: NvInfer.h:1261
Weights getBiasWeights() const noexcept
Get the bias weights for the convolution.
Definition: NvInfer.h:1206
int32_t getNbGroups() const noexcept
Get the number of groups of the convolution.
Definition: NvInfer.h:1157
void setPaddingMode(PaddingMode paddingMode) noexcept
Set the padding mode.
Definition: NvInfer.h:1302
TRT_DEPRECATED void setStride(DimsHW stride) noexcept
Get the stride of the convolution.
Definition: NvInfer.h:1085
Dims getPaddingNd() const noexcept
Get the multi-dimension padding of the convolution.
Definition: NvInfer.h:1392
Dims getStrideNd() const noexcept
Get the multi-dimension stride of the convolution.
Definition: NvInfer.h:1362
TRT_DEPRECATED void setPadding(DimsHW padding) noexcept
Set the padding of the convolution.
Definition: NvInfer.h:1115
Weights getKernelWeights() const noexcept
Get the kernel weights of the convolution.
Definition: NvInfer.h:1181
void setPaddingNd(Dims padding) noexcept
Set the multi-dimension padding of the convolution.
Definition: NvInfer.h:1380
Dims getDilationNd() const noexcept
Get the multi-dimension dilation of the convolution.
Definition: NvInfer.h:1416
void setKernelWeights(Weights weights) noexcept
Set the kernel weights for the convolution.
Definition: NvInfer.h:1171
void setDilationNd(Dims dilation) noexcept
Set the multi-dimension dilation of the convolution.
Definition: NvInfer.h:1406
Dims getPostPadding() const noexcept
Get the post-padding.
Definition: NvInfer.h:1288
TRT_DEPRECATED void setDilation(DimsHW dilation) noexcept
Set the dilation for a convolution.
Definition: NvInfer.h:1222
void setNbGroups(int32_t nbGroups) noexcept
Set the number of groups for a convolution.
Definition: NvInfer.h:1147
PaddingMode getPaddingMode() const noexcept
Get the padding mode.
Definition: NvInfer.h:1314
int32_t getNbOutputMaps() const noexcept
Get the number of output maps for the convolution.
Definition: NvInfer.h:1069
void setPrePadding(Dims padding) noexcept
Set the multi-dimension pre-padding of the convolution.
Definition: NvInfer.h:1251
virtual ~IConvolutionLayer() noexcept=default
void setBiasWeights(Weights weights) noexcept
Set the bias weights for the convolution.
Definition: NvInfer.h:1196
Dims getKernelSizeNd() const noexcept
Get the multi-dimension kernel size of the convolution.
Definition: NvInfer.h:1337
void setNbOutputMaps(int32_t nbOutputMaps) noexcept
Set the number of output maps for the convolution.
Definition: NvInfer.h:1059
TRT_DEPRECATED void setKernelSize(DimsHW kernelSize) noexcept
Set the HW kernel size of the convolution.
Definition: NvInfer.h:1035
void setPostPadding(Dims padding) noexcept
Set the multi-dimension post-padding of the convolution.
Definition: NvInfer.h:1278
TRT_DEPRECATED DimsHW getKernelSize() const noexcept
Get the HW kernel size of the convolution.
Definition: NvInfer.h:1047
An engine for executing inference on a built network, with functionally unsafe features.
Definition: NvInferRuntime.h:1379
A deconvolution layer in a network definition.
Definition: NvInfer.h:2432
void setBiasWeights(Weights weights) noexcept
Set the bias weights for the deconvolution.
Definition: NvInfer.h:2610
TRT_DEPRECATED void setStride(DimsHW stride) noexcept
Set the stride of the deconvolution.
Definition: NvInfer.h:2495
void setNbOutputMaps(int32_t nbOutputMaps) noexcept
Set the number of output feature maps for the deconvolution.
Definition: NvInfer.h:2469
Weights getKernelWeights() const noexcept
Get the kernel weights for the deconvolution.
Definition: NvInfer.h:2595
void setPrePadding(Dims padding) noexcept
Set the multi-dimension pre-padding of the deconvolution.
Definition: NvInfer.h:2638
TRT_DEPRECATED DimsHW getPadding() const noexcept
Get the padding of the deconvolution.
Definition: NvInfer.h:2541
Dims getStrideNd() const noexcept
Get the multi-dimension stride of the deconvolution.
Definition: NvInfer.h:2754
int32_t getNbGroups() const noexcept
Get the number of groups for a deconvolution.
Definition: NvInfer.h:2571
Dims getDilationNd() const noexcept
Get the multi-dimension dilation of the deconvolution.
Definition: NvInfer.h:2828
Weights getBiasWeights() const noexcept
Get the bias weights for the deconvolution.
Definition: NvInfer.h:2620
void setKernelWeights(Weights weights) noexcept
Set the kernel weights for the deconvolution.
Definition: NvInfer.h:2585
void setDilationNd(Dims dilation) noexcept
Set the multi-dimension dilation of the deconvolution.
Definition: NvInfer.h:2818
TRT_DEPRECATED DimsHW getStride() const noexcept
Get the stride of the deconvolution.
Definition: NvInfer.h:2507
TRT_DEPRECATED void setPadding(DimsHW padding) noexcept
Set the padding of the deconvolution.
Definition: NvInfer.h:2527
Dims getPostPadding() const noexcept
Get the padding.
Definition: NvInfer.h:2676
Dims getKernelSizeNd() const noexcept
Get the multi-dimension kernel size of the deconvolution.
Definition: NvInfer.h:2727
void setKernelSizeNd(Dims kernelSize) noexcept
Set the multi-dimension kernel size of the deconvolution.
Definition: NvInfer.h:2717
virtual ~IDeconvolutionLayer() noexcept=default
TRT_DEPRECATED void setKernelSize(DimsHW kernelSize) noexcept
Set the HW kernel size of the convolution.
Definition: NvInfer.h:2445
void setStrideNd(Dims stride) noexcept
Set the multi-dimension stride of the deconvolution.
Definition: NvInfer.h:2744
Dims getPaddingNd() const noexcept
Get the multi-dimension padding of the deconvolution.
Definition: NvInfer.h:2784
void setNbGroups(int32_t nbGroups) noexcept
Set the number of groups for a deconvolution.
Definition: NvInfer.h:2561
void setPaddingMode(PaddingMode paddingMode) noexcept
Set the padding mode.
Definition: NvInfer.h:2690
void setPaddingNd(Dims padding) noexcept
Set the multi-dimension padding of the deconvolution.
Definition: NvInfer.h:2772
TRT_DEPRECATED DimsHW getKernelSize() const noexcept
Get the HW kernel size of the deconvolution.
Definition: NvInfer.h:2457
void setPostPadding(Dims padding) noexcept
Set the multi-dimension post-padding of the deconvolution.
Definition: NvInfer.h:2666
int32_t getNbOutputMaps() const noexcept
Get the number of output feature maps for the deconvolution.
Definition: NvInfer.h:2479
Dims getPrePadding() const noexcept
Get the pre-padding.
Definition: NvInfer.h:2648
PaddingMode getPaddingMode() const noexcept
Get the padding mode.
Definition: NvInfer.h:2702
A Dequantize layer in a network definition.
Definition: NvInfer.h:5943
virtual ~IDequantizeLayer() noexcept=default
int32_t getAxis() const noexcept
Get the quantization axis.
Definition: NvInfer.h:5953
void setAxis(int32_t axis) noexcept
Set the quantization axis.
Definition: NvInfer.h:5964
An Einsum layer in a network.
Definition: NvInfer.h:6010
virtual ~IEinsumLayer() noexcept=default
bool setEquation(const char *equation) noexcept
Set the equation. The equation is a comma-separated list of subscript labels, where each label refers...
Definition: NvInfer.h:6021
const char * getEquation() const noexcept
Return the equation.
Definition: NvInfer.h:6031
A elementwise layer in a network definition.
Definition: NvInfer.h:2903
virtual ~IElementWiseLayer() noexcept=default
apiv::VElementWiseLayer * mImpl
Definition: NvInfer.h:2932
ElementWiseOperation getOperation() const noexcept
Get the binary operation for the layer.
Definition: NvInfer.h:2926
void setOperation(ElementWiseOperation op) noexcept
Set the binary operation for the layer.
Definition: NvInfer.h:2914
Reference counted application-implemented error reporting interface for TensorRT objects.
Definition: NvInferRuntimeCommon.h:1699
Generate an output tensor with specified mode.
Definition: NvInfer.h:5648
FillOperation getOperation() const noexcept
Get the fill operation for the layer.
Definition: NvInfer.h:5694
void setOperation(FillOperation op) noexcept
Set the fill operation for the layer.
Definition: NvInfer.h:5684
void setDimensions(Dims dimensions) noexcept
Set the output tensor's dimensions.
Definition: NvInfer.h:5659
void setBeta(double beta) noexcept
Set the beta parameter.
Definition: NvInfer.h:5745
double getAlpha() const noexcept
Get the value of alpha parameter.
Definition: NvInfer.h:5727
void setAlpha(double alpha) noexcept
Set the alpha parameter.
Definition: NvInfer.h:5712
Dims getDimensions() const noexcept
Get the output tensor's dimensions.
Definition: NvInfer.h:5674
double getBeta() const noexcept
Get the value of beta parameter.
Definition: NvInfer.h:5760
virtual ~IFillLayer() noexcept=default
A fully connected layer in a network definition. This layer expects an input tensor of three or more ...
Definition: NvInfer.h:1481
virtual ~IFullyConnectedLayer() noexcept=default
void setNbOutputChannels(int32_t nbOutputs) noexcept
Set the number of output channels K from the fully connected layer.
Definition: NvInfer.h:1490
Weights getKernelWeights() const noexcept
Get the kernel weights.
Definition: NvInfer.h:1520
void setBiasWeights(Weights weights) noexcept
Set the bias weights.
Definition: NvInfer.h:1532
void setKernelWeights(Weights weights) noexcept
Set the kernel weights, given as a KxC matrix in row-major order.
Definition: NvInfer.h:1510
int32_t getNbOutputChannels() const noexcept
Get the number of output channels K from the fully connected layer.
Definition: NvInfer.h:1500
Weights getBiasWeights() const noexcept
Get the bias weights.
Definition: NvInfer.h:1542
A Gather layer in a network definition. Supports several kinds of gathering.
Definition: NvInfer.h:3038
void setGatherAxis(int32_t axis) noexcept
Set the axis used by GatherMode::kELEMENTS and GatherMode::kDEFAULT The axis must be less than the nu...
Definition: NvInfer.h:3049
void setNbElementWiseDims(int32_t elementWiseDims) noexcept
Set the number of leading dimensions of indices tensor to be handled elementwise. The gathering of in...
Definition: NvInfer.h:3081
apiv::VGatherLayer * mImpl
Definition: NvInfer.h:3117
int32_t getNbElementWiseDims() const noexcept
Get the number of leading dimensions of indices tensor to be handled elementwise.
Definition: NvInfer.h:3091
void setMode(GatherMode mode) noexcept
Set the gather mode.
Definition: NvInfer.h:3101
int32_t getGatherAxis() const noexcept
Get the axis to gather on.
Definition: NvInfer.h:3060
GatherMode getMode() const noexcept
Get the gather mode.
Definition: NvInfer.h:3111
virtual ~IGatherLayer() noexcept=default
Application-implemented class for controlling allocation on the GPU.
Definition: NvInferRuntimeCommon.h:1372
Class to handle library allocated memory that is accessible to the user.
Definition: NvInferRuntime.h:181
A layer that represents the identity function.
Definition: NvInfer.h:4588
apiv::VIdentityLayer * mImpl
Definition: NvInfer.h:4590
virtual ~IIdentityLayer() noexcept=default
Definition: NvInfer.h:5154
IIfConditional * getConditional() const noexcept
Return pointer to the IIfConditional associated with this boundary layer.
Definition: NvInfer.h:5157
virtual ~IIfConditionalBoundaryLayer() noexcept=default
Definition: NvInfer.h:5224
IIfConditionalInputLayer * addInput(ITensor &input) noexcept
Add an If-conditional input.
Definition: NvInfer.h:5263
virtual ~IIfConditional() noexcept=default
void setName(const char *name) noexcept
Set the name of the conditional.
Definition: NvInfer.h:5276
IConditionLayer * setCondition(ITensor &condition) noexcept
Set the condition tensor for this If-Conditional construct.
Definition: NvInfer.h:5235
IIfConditionalOutputLayer * addOutput(ITensor &trueSubgraphOutput, ITensor &falseSubgraphOutput) noexcept
Add an If-conditional output.
Definition: NvInfer.h:5251
const char * getName() const noexcept
Return the name of the conditional.
Definition: NvInfer.h:5286
Definition: NvInfer.h:5195
virtual ~IIfConditionalInputLayer() noexcept=default
Definition: NvInfer.h:5184
virtual ~IIfConditionalOutputLayer() noexcept=default
Application-implemented interface for calibration.
Definition: NvInfer.h:7454
virtual int32_t getBatchSize() const noexcept=0
Get the batch size used for calibration batches.
Definition: NvInfer.h:7537
CalibrationAlgoType getAlgorithm() noexcept override
Definition: NvInfer.h:7542
virtual ~IInt8EntropyCalibrator2() noexcept=default
Definition: NvInfer.h:7519
virtual ~IInt8EntropyCalibrator() noexcept=default
CalibrationAlgoType getAlgorithm() noexcept override
Definition: NvInfer.h:7524
Definition: NvInfer.h:7572
CalibrationAlgoType getAlgorithm() noexcept override
Definition: NvInfer.h:7577
virtual double getQuantile() const noexcept=0
The quantile (between 0 and 1) that will be used to select the region maximum when the quantile metho...
Definition: NvInfer.h:7554
CalibrationAlgoType getAlgorithm() noexcept override
Definition: NvInfer.h:7559
virtual ~IInt8MinMaxCalibrator() noexcept=default
Definition: NvInfer.h:5414
virtual ~IIteratorLayer() noexcept=default
void setReverse(bool reverse) noexcept
Definition: NvInfer.h:5433
bool getReverse() const noexcept
True if and only if reversing input.
Definition: NvInfer.h:5439
int32_t getAxis() const noexcept
Get axis being iterated over.
Definition: NvInfer.h:5423
void setAxis(int32_t axis) noexcept
Set axis to iterate over.
Definition: NvInfer.h:5417
A LRN layer in a network definition.
Definition: NvInfer.h:2041
int32_t getWindowSize() const noexcept
Get the LRN window size.
Definition: NvInfer.h:2062
float getAlpha() const noexcept
Get the LRN alpha value.
Definition: NvInfer.h:2083
void setWindowSize(int32_t windowSize) noexcept
Set the LRN window size.
Definition: NvInfer.h:2052
void setK(float k) noexcept
Set the LRN K value.
Definition: NvInfer.h:2115
void setAlpha(float alpha) noexcept
Set the LRN alpha value.
Definition: NvInfer.h:2073
void setBeta(float beta) noexcept
Set the LRN beta value.
Definition: NvInfer.h:2094
virtual ~ILRNLayer() noexcept=default
float getBeta() const noexcept
Get the LRN beta value.
Definition: NvInfer.h:2104
float getK() const noexcept
Get the LRN K value.
Definition: NvInfer.h:2125
Base class for all layer classes in a network definition.
Definition: NvInfer.h:529
bool precisionIsSet() const noexcept
whether the computational precision has been set for this layer
Definition: NvInfer.h:668
void setPrecision(DataType dataType) noexcept
Set the computational precision of this layer.
Definition: NvInfer.h:644
void resetPrecision() noexcept
reset the computational precision for this layer
Definition: NvInfer.h:678
int32_t getNbInputs() const noexcept
Get the number of inputs of a layer.
Definition: NvInfer.h:567
DataType getOutputType(int32_t index) const noexcept
get the output type of this layer
Definition: NvInfer.h:730
DataType getPrecision() const noexcept
get the computational precision of this layer
Definition: NvInfer.h:656
int32_t getNbOutputs() const noexcept
Get the number of outputs of a layer.
Definition: NvInfer.h:588
void setName(const char *name) noexcept
Set the name of a layer.
Definition: NvInfer.h:548
bool outputTypeIsSet(int32_t index) const noexcept
whether the output type has been set for this layer
Definition: NvInfer.h:743
ITensor * getOutput(int32_t index) const noexcept
Get the layer output corresponding to the given index.
Definition: NvInfer.h:599
void setInput(int32_t index, ITensor &tensor) noexcept
Replace an input of this layer with a specific tensor.
Definition: NvInfer.h:616
void resetOutputType(int32_t index) noexcept
reset the output type for this layer
Definition: NvInfer.h:755
ITensor * getInput(int32_t index) const noexcept
Get the layer input corresponding to the given index.
Definition: NvInfer.h:580
void setOutputType(int32_t index, DataType dataType) noexcept
Set the output type of this layer.
Definition: NvInfer.h:716
LayerType getType() const noexcept
Return the type of a layer.
Definition: NvInfer.h:536
const char * getName() const noexcept
Return the name of a layer.
Definition: NvInfer.h:559
virtual ~ILayer() noexcept=default
Application-implemented logging interface for the builder, refitter and runtime.
Definition: NvInferRuntimeCommon.h:1510
Definition: NvInfer.h:5135
virtual ~ILoopBoundaryLayer() noexcept=default
ILoop * getLoop() const noexcept
Return pointer to ILoop associated with this boundary layer.
Definition: NvInfer.h:5138
Definition: NvInfer.h:5455
ITripLimitLayer * addTripLimit(ITensor &tensor, TripLimit limit) noexcept
Add a trip-count limiter, based on the given tensor.
Definition: NvInfer.h:5484
IIteratorLayer * addIterator(ITensor &tensor, int32_t axis=0, bool reverse=false) noexcept
Return layer that subscripts tensor by loop iteration.
Definition: NvInfer.h:5497
ILoopOutputLayer * addLoopOutput(ITensor &tensor, LoopOutput outputKind, int32_t axis=0) noexcept
Make an output for this loop, based on the given tensor.
Definition: NvInfer.h:5509
virtual ~ILoop() noexcept=default
const char * getName() const noexcept
Return the name of the loop.
Definition: NvInfer.h:5532
void setName(const char *name) noexcept
Set the name of the loop.
Definition: NvInfer.h:5522
IRecurrenceLayer * addRecurrence(ITensor &initialValue) noexcept
Create a recurrence layer for this loop with initialValue as its first input.
Definition: NvInfer.h:5463
Definition: NvInfer.h:5343
virtual ~ILoopOutputLayer() noexcept=default
int32_t getAxis() const noexcept
Get axis being concatenated over.
Definition: NvInfer.h:5368
LoopOutput getLoopOutput() const noexcept
Definition: NvInfer.h:5345
void setAxis(int32_t axis) noexcept
Set where to insert the contenation axis. Ignored if getLoopOutput() is kLAST_VALUE.
Definition: NvInfer.h:5362
Layer that represents a Matrix Multiplication.
Definition: NvInfer.h:4513
apiv::VMatrixMultiplyLayer * mImpl
Definition: NvInfer.h:4539
virtual ~IMatrixMultiplyLayer() noexcept=default
MatrixOperation getOperation(int32_t index) const noexcept
Get the operation for an input tensor.
Definition: NvInfer.h:4533
void setOperation(int32_t index, MatrixOperation op) noexcept
Set the operation for an input tensor.
Definition: NvInfer.h:4521
A network definition for input to the builder.
Definition: NvInfer.h:6185
IPluginV2Layer * addPluginV2(ITensor *const *inputs, int32_t nbInputs, IPluginV2 &plugin) noexcept
Add a plugin layer to the network using the IPluginV2 interface.
Definition: NvInfer.h:6887
IConvolutionLayer * addConvolutionNd(ITensor &input, int32_t nbOutputMaps, Dims kernelSize, Weights kernelWeights, Weights biasWeights) noexcept
Add a multi-dimension convolution layer to the network.
Definition: NvInfer.h:7049
IDequantizeLayer * addDequantize(ITensor &input, ITensor &scale) noexcept
Add a dequantization layer to the network.
Definition: NvInfer.h:7341
IConcatenationLayer * addConcatenation(ITensor *const *inputs, int32_t nbInputs) noexcept
Add a concatenation layer to the network.
Definition: NvInfer.h:6399
TRT_DEPRECATED IDeconvolutionLayer * addDeconvolution(ITensor &input, int32_t nbOutputMaps, DimsHW kernelSize, Weights kernelWeights, Weights biasWeights) noexcept
Add a deconvolution layer to the network.
Definition: NvInfer.h:6422
IGatherLayer * addGatherV2(ITensor &data, ITensor &indices, GatherMode mode)
Add gather with specified mode, axis=0 and nbElementWiseDims=0.
Definition: NvInfer.h:6692
IShuffleLayer * addShuffle(ITensor &input) noexcept
Add a shuffle layer to the network.
Definition: NvInfer.h:6503
ILRNLayer * addLRN(ITensor &input, int32_t window, float alpha, float beta, float k) noexcept
Add a LRN layer to the network.
Definition: NvInfer.h:6342
ITopKLayer * addTopK(ITensor &input, TopKOperation op, int32_t k, uint32_t reduceAxes) noexcept
Add a TopK layer to the network.
Definition: NvInfer.h:6660
IAssertionLayer * addAssertion(ITensor &condition, const char *message) noexcept
Add an assertion layer to the network.
Definition: NvInfer.h:7233
IScaleLayer * addScaleNd(ITensor &input, ScaleMode mode, Weights shift, Weights scale, Weights power, int32_t channelAxis) noexcept
Add a multi-dimension scale layer to the network.
Definition: NvInfer.h:7127
TRT_DEPRECATED bool hasExplicitPrecision() const noexcept
True if network is an explicit precision network.
Definition: NvInfer.h:7160
IParametricReLULayer * addParametricReLU(ITensor &input, ITensor &slope) noexcept
Add a parametric ReLU layer to the network.
Definition: NvInfer.h:7027
ITensor * getOutput(int32_t index) const noexcept
Get the output tensor specified by the given index.
Definition: NvInfer.h:6587
ITensor * getInput(int32_t index) const noexcept
Get the input tensor specified by the given index.
Definition: NvInfer.h:6557
bool unmarkOutputForShapes(ITensor &tensor) noexcept
Undo markOutputForShapes.
Definition: NvInfer.h:7009
IFillLayer * addFill(Dims dimensions, FillOperation op) noexcept
Add a fill layer to the network.
Definition: NvInfer.h:7251
ILoop * addLoop() noexcept
Add a loop to the network.
Definition: NvInfer.h:7176
IDeconvolutionLayer * addDeconvolutionNd(ITensor &input, int32_t nbOutputMaps, Dims kernelSize, Weights kernelWeights, Weights biasWeights) noexcept
Add a multi-dimension deconvolution layer to the network.
Definition: NvInfer.h:7091
IActivationLayer * addActivation(ITensor &input, ActivationType type) noexcept
Add an activation layer to the network.
Definition: NvInfer.h:6304
virtual ~INetworkDefinition() noexcept=default
void setName(const char *name) noexcept
Sets the name of the network.
Definition: NvInfer.h:6928
ILayer * getLayer(int32_t index) const noexcept
Get the layer specified by the given index.
Definition: NvInfer.h:6529
TRT_DEPRECATED IRNNv2Layer * addRNNv2(ITensor &input, int32_t layerCount, int32_t hiddenSize, int32_t maxSeqLen, RNNOperation op) noexcept
Add an layerCount deep RNN layer to the network with hiddenSize internal states that can take a batch...
Definition: NvInfer.h:6826
TRT_DEPRECATED IFullyConnectedLayer * addFullyConnected(ITensor &input, int32_t nbOutputs, Weights kernelWeights, Weights biasWeights) noexcept
Add a fully connected layer to the network.
Definition: NvInfer.h:6284
IIfConditional * addIfConditional() noexcept
Add an If-conditional layer to the network.
Definition: NvInfer.h:7395
IErrorRecorder * getErrorRecorder() const noexcept
get the ErrorRecorder assigned to this interface.
Definition: NvInfer.h:7322
int32_t getNbInputs() const noexcept
Get the number of inputs in the network.
Definition: NvInfer.h:6541
bool hasImplicitBatchDimension() const noexcept
Query whether the network was created with an implicit batch dimension.
Definition: NvInfer.h:6979
IReduceLayer * addReduce(ITensor &input, ReduceOperation operation, uint32_t reduceAxes, bool keepDimensions) noexcept
Add a reduce layer to the network.
Definition: NvInfer.h:6626
IUnaryLayer * addUnary(ITensor &input, UnaryOperation operation) noexcept
Add a unary layer to the network.
Definition: NvInfer.h:6472
const char * getName() const noexcept
Returns the name associated with the network.
Definition: NvInfer.h:6942
void removeTensor(ITensor &tensor) noexcept
remove a tensor from the network definition.
Definition: NvInfer.h:6856
ISelectLayer * addSelect(ITensor &condition, ITensor &thenInput, ITensor &elseInput) noexcept
Add a select layer to the network.
Definition: NvInfer.h:7216
IScatterLayer * addScatter(ITensor &data, ITensor &indices, ITensor &updates, ScatterMode mode) noexcept
Add a Scatter layer to the network with specified mode and axis=0.
Definition: NvInfer.h:7361
int32_t getNbLayers() const noexcept
Get the number of layers in the network.
Definition: NvInfer.h:6515
apiv::VNetworkDefinition * mImpl
Definition: NvInfer.h:7415
IPoolingLayer * addPoolingNd(ITensor &input, PoolingType type, Dims windowSize) noexcept
Add a multi-dimension pooling layer to the network.
Definition: NvInfer.h:7069
bool markOutputForShapes(ITensor &tensor) noexcept
Enable tensor's value to be computed by IExecutionContext::getShapeBinding.
Definition: NvInfer.h:6997
TRT_DEPRECATED IPaddingLayer * addPadding(ITensor &input, DimsHW prePadding, DimsHW postPadding) noexcept
Add a padding layer to the network.
Definition: NvInfer.h:6489
IScaleLayer * addScale(ITensor &input, ScaleMode mode, Weights shift, Weights scale, Weights power) noexcept
Add a Scale layer to the network.
Definition: NvInfer.h:6369
void unmarkOutput(ITensor &tensor) noexcept
unmark a tensor as a network output.
Definition: NvInfer.h:6868
IIdentityLayer * addIdentity(ITensor &input) noexcept
Add an identity layer.
Definition: NvInfer.h:6841
TRT_DEPRECATED IConvolutionLayer * addConvolution(ITensor &input, int32_t nbOutputMaps, DimsHW kernelSize, Weights kernelWeights, Weights biasWeights) noexcept
Add a convolution layer to the network.
Definition: NvInfer.h:6261
IQuantizeLayer * addQuantize(ITensor &input, ITensor &scale) noexcept
Add a quantization layer to the network.
Definition: NvInfer.h:7380
IElementWiseLayer * addElementWise(ITensor &input1, ITensor &input2, ElementWiseOperation op) noexcept
Add an elementwise layer to the network.
Definition: NvInfer.h:6450
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInfer.h:7307
ISliceLayer * addSlice(ITensor &input, Dims start, Dims size, Dims stride) noexcept
Add a slice layer to the network.
Definition: NvInfer.h:6906
IConstantLayer * addConstant(Dims dimensions, Weights weights) noexcept
Add a constant layer to the network.
Definition: NvInfer.h:6757
IRaggedSoftMaxLayer * addRaggedSoftMax(ITensor &input, ITensor &bounds) noexcept
Add a RaggedSoftMax layer to the network.
Definition: NvInfer.h:6710
IShapeLayer * addShape(ITensor &input) noexcept
Add a shape layer to the network.
Definition: NvInfer.h:6960
IGatherLayer * addGather(ITensor &data, ITensor &indices, int32_t axis) noexcept
Add gather with mode GatherMode::kDEFAULT and specified axis and nbElementWiseDims=0.
Definition: NvInfer.h:6676
IEinsumLayer * addEinsum(ITensor *const *inputs, int32_t nbInputs, const char *equation) noexcept
Add an Einsum layer to the network.
Definition: NvInfer.h:7409
TRT_DEPRECATED IPoolingLayer * addPooling(ITensor &input, PoolingType type, DimsHW windowSize) noexcept
Add a pooling layer to the network.
Definition: NvInfer.h:6323
TRT_DEPRECATED void destroy() noexcept
Destroy this INetworkDefinition object.
Definition: NvInfer.h:6599
IResizeLayer * addResize(ITensor &input) noexcept
Add a resize layer to the network.
Definition: NvInfer.h:7143
IMatrixMultiplyLayer * addMatrixMultiply(ITensor &input0, MatrixOperation op0, ITensor &input1, MatrixOperation op1) noexcept
Add a MatrixMultiply layer to the network.
Definition: NvInfer.h:6731
ISoftMaxLayer * addSoftMax(ITensor &input) noexcept
Add a SoftMax layer to the network.
Definition: NvInfer.h:6382
void markOutput(ITensor &tensor) noexcept
Mark a tensor as a network output.
Definition: NvInfer.h:6238
bool setWeightsName(Weights weights, const char *name) noexcept
Associate a name with all current uses of the given weights.
Definition: NvInfer.h:7288
int32_t getNbOutputs() const noexcept
Get the number of outputs in the network.
Definition: NvInfer.h:6571
TRT_DEPRECATED IPaddingLayer * addPaddingNd(ITensor &input, Dims prePadding, Dims postPadding) noexcept
Add a padding layer to the network. Only 2D padding is currently supported.
Definition: NvInfer.h:7268
Forward declaration of IEngineInspector for use by other interfaces.
Definition: NvInferRuntime.h:80
Optimization profile for dynamic input dimensions and shape tensors.
Definition: NvInferRuntime.h:1160
Layer that represents a padding operation.
Definition: NvInfer.h:3835
Dims getPostPaddingNd() const noexcept
Get the padding that is applied at the end of the tensor.
Definition: NvInfer.h:3936
TRT_DEPRECATED DimsHW getPrePadding() const noexcept
Get the padding that is applied at the start of the tensor.
Definition: NvInfer.h:3858
TRT_DEPRECATED void setPostPadding(DimsHW padding) noexcept
Set the padding that is applied at the end of the tensor.
Definition: NvInfer.h:3872
virtual ~IPaddingLayer() noexcept=default
TRT_DEPRECATED void setPrePadding(DimsHW padding) noexcept
Set the padding that is applied at the start of the tensor.
Definition: NvInfer.h:3846
Dims getPrePaddingNd() const noexcept
Get the padding that is applied at the start of the tensor.
Definition: NvInfer.h:3910
TRT_DEPRECATED DimsHW getPostPadding() const noexcept
Get the padding that is applied at the end of the tensor.
Definition: NvInfer.h:3884
void setPostPaddingNd(Dims padding) noexcept
Set the padding that is applied at the end of the tensor.
Definition: NvInfer.h:3924
void setPrePaddingNd(Dims padding) noexcept
Set the padding that is applied at the start of the tensor.
Definition: NvInfer.h:3898
apiv::VPaddingLayer * mImpl
Definition: NvInfer.h:3942
Layer that represents a parametric ReLU operation.
Definition: NvInfer.h:4668
apiv::VParametricReLULayer * mImpl
Definition: NvInfer.h:4670
virtual ~IParametricReLULayer() noexcept=default
Single registration point for all plugins in an application. It is used to find plugin implementation...
Definition: NvInferRuntimeCommon.h:1244
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:411
Layer type for pluginV2.
Definition: NvInfer.h:3606
virtual ~IPluginV2Layer() noexcept=default
apiv::VPluginV2Layer * mImpl
Definition: NvInfer.h:3619
IPluginV2 & getPlugin() noexcept
Get the plugin for the layer.
Definition: NvInfer.h:3613
A Pooling layer in a network definition.
Definition: NvInfer.h:1703
TRT_DEPRECATED DimsHW getStride() const noexcept
Get the stride for pooling.
Definition: NvInfer.h:1776
PoolingType getPoolingType() const noexcept
Get the type of activation to be performed.
Definition: NvInfer.h:1722
void setWindowSizeNd(Dims windowSize) noexcept
Set the multi-dimension window size for pooling.
Definition: NvInfer.h:1955
PaddingMode getPaddingMode() const noexcept
Get the padding mode.
Definition: NvInfer.h:1942
Dims getPostPadding() const noexcept
Get the padding.
Definition: NvInfer.h:1918
TRT_DEPRECATED void setStride(DimsHW stride) noexcept
Set the stride for pooling.
Definition: NvInfer.h:1764
bool getAverageCountExcludesPadding() const noexcept
Get whether average pooling uses as a denominator the overlap area between the window and the unpadde...
Definition: NvInfer.h:1862
Dims getPrePadding() const noexcept
Get the pre-padding.
Definition: NvInfer.h:1890
void setPoolingType(PoolingType type) noexcept
Set the type of activation to be performed.
Definition: NvInfer.h:1712
void setPaddingMode(PaddingMode paddingMode) noexcept
Set the padding mode.
Definition: NvInfer.h:1931
TRT_DEPRECATED void setWindowSize(DimsHW windowSize) noexcept
Set the window size for pooling.
Definition: NvInfer.h:1736
Dims getWindowSizeNd() const noexcept
Get the multi-dimension window size for pooling.
Definition: NvInfer.h:1965
void setAverageCountExcludesPadding(bool exclusive) noexcept
Set whether average pooling uses as a denominator the overlap area between the window and the unpadde...
Definition: NvInfer.h:1851
void setPaddingNd(Dims padding) noexcept
Set the multi-dimension padding for pooling.
Definition: NvInfer.h:2009
void setPrePadding(Dims padding) noexcept
Set the multi-dimension pre-padding for pooling.
Definition: NvInfer.h:1880
float getBlendFactor() const noexcept
Get the blending factor for the max_average_blend mode: max_average_blendPool = (1-blendFactor)*maxPo...
Definition: NvInfer.h:1834
Dims getStrideNd() const noexcept
Get the multi-dimension stride for pooling.
Definition: NvInfer.h:1990
virtual ~IPoolingLayer() noexcept=default
Dims getPaddingNd() const noexcept
Get the multi-dimension padding for pooling.
Definition: NvInfer.h:2021
TRT_DEPRECATED DimsHW getWindowSize() const noexcept
Get the window size for pooling.
Definition: NvInfer.h:1748
TRT_DEPRECATED DimsHW getPadding() const noexcept
Get the padding for pooling.
Definition: NvInfer.h:1806
void setStrideNd(Dims stride) noexcept
Set the multi-dimension stride for pooling.
Definition: NvInfer.h:1980
void setPostPadding(Dims padding) noexcept
Set the multi-dimension post-padding for pooling.
Definition: NvInfer.h:1908
TRT_DEPRECATED void setPadding(DimsHW padding) noexcept
Set the padding for pooling.
Definition: NvInfer.h:1792
void setBlendFactor(float blendFactor) noexcept
Set the blending factor for the max_average_blend mode: max_average_blendPool = (1-blendFactor)*maxPo...
Definition: NvInfer.h:1821
A Quantize layer in a network definition.
Definition: NvInfer.h:5856
void setAxis(int32_t axis) noexcept
Set the quantization axis.
Definition: NvInfer.h:5877
int32_t getAxis() const noexcept
Get the quantization axis.
Definition: NvInfer.h:5866
virtual ~IQuantizeLayer() noexcept=default
An RNN layer in a network definition, version 2.
Definition: NvInfer.h:3316
void setDirection(RNNDirection op) noexcept
Set the direction of the RNN layer.
Definition: NvInfer.h:3416
void setBiasForGate(int32_t layerIndex, RNNGateType gate, bool isW, Weights bias) noexcept
Set the bias parameters for an individual gate in the RNN.
Definition: NvInfer.h:3520
void setCellState(ITensor &cell) noexcept
Set the initial cell state of the LSTM with the provided cell ITensor.
Definition: NvInfer.h:3576
int32_t getDataLength() const noexcept
Get the maximum data length of the RNN.
Definition: NvInfer.h:3330
void setInputMode(RNNInputMode op) noexcept
Set the input mode of the RNN layer.
Definition: NvInfer.h:3391
Weights getBiasForGate(int32_t layerIndex, RNNGateType gate, bool isW) const noexcept
Get the bias parameters for an individual gate in the RNN.
Definition: NvInfer.h:3530
void setWeightsForGate(int32_t layerIndex, RNNGateType gate, bool isW, Weights weights) noexcept
Set the weight parameters for an individual gate in the RNN.
Definition: NvInfer.h:3485
void setOperation(RNNOperation op) noexcept
Set the operation of the RNN layer.
Definition: NvInfer.h:3371
Weights getWeightsForGate(int32_t layerIndex, RNNGateType gate, bool isW) const noexcept
Get the weight parameters for an individual gate in the RNN.
Definition: NvInfer.h:3495
RNNDirection getDirection() const noexcept
Get the direction of the RNN layer.
Definition: NvInfer.h:3426
void setSequenceLengths(ITensor &seqLengths) noexcept
Specify individual sequence lengths in the batch with the ITensor pointed to by seqLengths.
Definition: NvInfer.h:3349
RNNInputMode getInputMode() const noexcept
Get the input mode of the RNN layer.
Definition: NvInfer.h:3401
ITensor * getHiddenState() const noexcept
Get the initial hidden state of the RNN.
Definition: NvInfer.h:3557
ITensor * getCellState() const noexcept
Get the initial cell state of the RNN.
Definition: NvInfer.h:3586
int32_t getMaxSeqLength() const noexcept
Get the maximum sequence length of the RNN.
Definition: NvInfer.h:3326
int32_t getLayerCount() const noexcept
Get the layer count of the RNN.
Definition: NvInfer.h:3318
apiv::VRNNv2Layer * mImpl
Definition: NvInfer.h:3592
ITensor * getSequenceLengths() const noexcept
Get the sequence lengths specified for the RNN.
Definition: NvInfer.h:3361
RNNOperation getOperation() const noexcept
Get the operation of the RNN layer.
Definition: NvInfer.h:3381
virtual ~IRNNv2Layer() noexcept=default
int32_t getHiddenSize() const noexcept
Get the hidden size of the RNN.
Definition: NvInfer.h:3322
void setHiddenState(ITensor &hidden) noexcept
Set the initial hidden state of the RNN with the provided hidden ITensor.
Definition: NvInfer.h:3547
A RaggedSoftmax layer in a network definition.
Definition: NvInfer.h:4558
apiv::VRaggedSoftMaxLayer * mImpl
Definition: NvInfer.h:4560
virtual ~IRaggedSoftMaxLayer() noexcept=default
Definition: NvInfer.h:5298
virtual ~IRecurrenceLayer() noexcept=default
Layer that represents a reduction across a non-bool tensor.
Definition: NvInfer.h:3757
void setKeepDimensions(bool keepDimensions) noexcept
Set the boolean that specifies whether or not to keep the reduced dimensions for the layer.
Definition: NvInfer.h:3804
void setOperation(ReduceOperation op) noexcept
Set the reduce operation for the layer.
Definition: NvInfer.h:3764
ReduceOperation getOperation() const noexcept
Get the reduce operation for the layer.
Definition: NvInfer.h:3774
virtual ~IReduceLayer() noexcept=default
uint32_t getReduceAxes() const noexcept
Get the axes over which to reduce for the layer.
Definition: NvInfer.h:3794
void setReduceAxes(uint32_t reduceAxes) noexcept
Set the axes over which to reduce.
Definition: NvInfer.h:3784
apiv::VReduceLayer * mImpl
Definition: NvInfer.h:3820
bool getKeepDimensions() const noexcept
Get the boolean that specifies whether or not to keep the reduced dimensions for the layer.
Definition: NvInfer.h:3814
A resize layer in a network definition.
Definition: NvInfer.h:4856
void setSelectorForSinglePixel(ResizeSelector selector) noexcept
Set coordinate selector function when resized to single pixel.
Definition: NvInfer.h:5045
void setOutputDimensions(Dims dimensions) noexcept
Set the output dimensions.
Definition: NvInfer.h:4876
void setNearestRounding(ResizeRoundMode value) noexcept
Set rounding mode for nearest neighbor resize.
Definition: NvInfer.h:5069
virtual ~IResizeLayer() noexcept=default
int32_t getScales(int32_t size, float *scales) const noexcept
Copies resize scales to scales[0, ..., nbScales-1], where nbScales is the number of scales that were ...
Definition: NvInfer.h:4935
ResizeMode getResizeMode() const noexcept
Get resize mode for an input tensor.
Definition: NvInfer.h:4957
void setResizeMode(ResizeMode resizeMode) noexcept
Set resize mode for an input tensor.
Definition: NvInfer.h:4947
ResizeSelector getSelectorForSinglePixel() const noexcept
Get the coordinate selector function when resized to single pixel.
Definition: NvInfer.h:5055
TRT_DEPRECATED bool getAlignCorners() const noexcept
True if align corners has been set.
Definition: NvInfer.h:4985
void setCoordinateTransformation(ResizeCoordinateTransformation coordTransform) noexcept
Set coordinate transformation function.
Definition: NvInfer.h:5020
void setScales(const float *scales, int32_t nbScales) noexcept
Set the resize scales.
Definition: NvInfer.h:4916
Dims getOutputDimensions() const noexcept
Get the output dimensions.
Definition: NvInfer.h:4886
ResizeRoundMode getNearestRounding() const noexcept
Get rounding mode for nearest neighbor resize.
Definition: NvInfer.h:5079
TRT_DEPRECATED void setAlignCorners(bool alignCorners) noexcept
Set whether to align corners while resizing.
Definition: NvInfer.h:4973
ResizeCoordinateTransformation getCoordinateTransformation() const noexcept
Get coordinate transformation function.
Definition: NvInfer.h:5030
A Scale layer in a network definition.
Definition: NvInfer.h:2185
Weights getScale() const noexcept
Get the scale value.
Definition: NvInfer.h:2242
Weights getPower() const noexcept
Get the power value.
Definition: NvInfer.h:2262
void setScale(Weights scale) noexcept
Set the scale value.
Definition: NvInfer.h:2232
void setPower(Weights power) noexcept
Set the power value.
Definition: NvInfer.h:2252
ScaleMode getMode() const noexcept
Get the scale mode.
Definition: NvInfer.h:2202
void setShift(Weights shift) noexcept
Set the shift value.
Definition: NvInfer.h:2212
void setChannelAxis(int32_t channelAxis) noexcept
Set the channel axis.
Definition: NvInfer.h:2298
Weights getShift() const noexcept
Get the shift value.
Definition: NvInfer.h:2222
virtual ~IScaleLayer() noexcept=default
void setMode(ScaleMode mode) noexcept
Set the scale mode.
Definition: NvInfer.h:2192
int32_t getChannelAxis() const noexcept
Get the channel axis.
Definition: NvInfer.h:2277
A scatter layer in a network definition. Supports several kinds of scattering.
Definition: NvInfer.h:6120
void setMode(ScatterMode mode) noexcept
Set the scatter mode.
Definition: NvInfer.h:6127
apiv::VScatterLayer * mImpl
Definition: NvInfer.h:6161
void setAxis(int32_t axis) noexcept
Set the axis used by ScatterMode::kELEMENTS.
Definition: NvInfer.h:6147
int32_t getAxis() const noexcept
Get the axis.
Definition: NvInfer.h:6155
ScatterMode getMode() const noexcept
Get the scatter mode.
Definition: NvInfer.h:6137
virtual ~IScatterLayer() noexcept=default
Definition: NvInfer.h:5546
virtual ~ISelectLayer() noexcept=default
Layer type for getting shape of a tensor.
Definition: NvInfer.h:4342
virtual ~IShapeLayer() noexcept=default
apiv::VShapeLayer * mImpl
Definition: NvInfer.h:4344
Layer type for shuffling data.
Definition: NvInfer.h:3970
apiv::VShuffleLayer * mImpl
Definition: NvInfer.h:4125
void setReshapeDimensions(Dims dimensions) noexcept
Set the reshaped dimensions.
Definition: NvInfer.h:4018
void setFirstTranspose(Permutation permutation) noexcept
Set the permutation applied by the first transpose operation.
Definition: NvInfer.h:3981
void setSecondTranspose(Permutation permutation) noexcept
Set the permutation applied by the second transpose operation.
Definition: NvInfer.h:4078
Dims getReshapeDimensions() const noexcept
Get the reshaped dimensions.
Definition: NvInfer.h:4031
Permutation getFirstTranspose() const noexcept
Get the permutation applied by the first transpose operation.
Definition: NvInfer.h:3993
virtual ~IShuffleLayer() noexcept=default
Permutation getSecondTranspose() const noexcept
Get the permutation applied by the second transpose operation.
Definition: NvInfer.h:4090
bool getZeroIsPlaceholder() const noexcept
Get meaning of 0 in reshape dimensions.
Definition: NvInfer.h:4119
void setZeroIsPlaceholder(bool zeroIsPlaceholder) noexcept
Set meaning of 0 in reshape dimensions.
Definition: NvInfer.h:4106
Slices an input tensor into an output tensor based on the offset and strides.
Definition: NvInfer.h:4192
void setMode(SliceMode mode) noexcept
Set the slice mode.
Definition: NvInfer.h:4286
apiv::VSliceLayer * mImpl
Definition: NvInfer.h:4325
virtual ~ISliceLayer() noexcept=default
void setStride(Dims stride) noexcept
Set the stride for computing the output slice data.
Definition: NvInfer.h:4261
void setStart(Dims start) noexcept
Set the start offset that the slice layer uses to create the output slice.
Definition: NvInfer.h:4203
Dims getStart() const noexcept
Get the start offset for the slice layer.
Definition: NvInfer.h:4218
void setSize(Dims size) noexcept
Set the dimensions of the output slice.
Definition: NvInfer.h:4232
Dims getSize() const noexcept
Get dimensions of the output slice.
Definition: NvInfer.h:4247
SliceMode getMode() const noexcept
Get the slice mode.
Definition: NvInfer.h:4296
Dims getStride() const noexcept
Get the stride for the output slice.
Definition: NvInfer.h:4276
A Softmax layer in a network definition.
Definition: NvInfer.h:2325
void setAxes(uint32_t axes) noexcept
Set the axis along which softmax is computed. Currently, only one axis can be set.
Definition: NvInfer.h:2359
uint32_t getAxes() const noexcept
Get the axis along which softmax occurs.
Definition: NvInfer.h:2369
virtual ~ISoftMaxLayer() noexcept=default
A tensor in a network definition.
Definition: NvInfer.h:204
bool setDynamicRange(float min, float max) noexcept
Set dynamic range for the tensor.
Definition: NvInfer.h:304
void setAllowedFormats(TensorFormats formats) noexcept
Set allowed formats for this tensor. By default all formats are allowed. Shape tensors (for which isS...
Definition: NvInfer.h:440
TensorLocation getLocation() const noexcept
Get the storage location of a tensor.
Definition: NvInfer.h:368
void setName(const char *name) noexcept
Set the tensor name.
Definition: NvInfer.h:218
void resetDynamicRange() noexcept
Undo effect of setDynamicRange.
Definition: NvInfer.h:401
bool isExecutionTensor() const noexcept
Whether the tensor is an execution tensor.
Definition: NvInfer.h:511
void setType(DataType type) noexcept
Set the data type of a tensor.
Definition: NvInfer.h:277
bool dynamicRangeIsSet() const noexcept
Query whether dynamic range is set.
Definition: NvInfer.h:393
void setLocation(TensorLocation location) noexcept
Set the storage location of a tensor.
Definition: NvInfer.h:383
bool isShapeTensor() const noexcept
Whether the tensor is a shape tensor.
Definition: NvInfer.h:488
float getDynamicRangeMax() const noexcept
Get maximum of dynamic range.
Definition: NvInfer.h:421
bool isNetworkInput() const noexcept
Whether the tensor is a network input.
Definition: NvInfer.h:312
bool isNetworkOutput() const noexcept
Whether the tensor is a network output.
Definition: NvInfer.h:320
bool getBroadcastAcrossBatch() const noexcept
Check if tensor is broadcast across the batch.
Definition: NvInfer.h:358
void setBroadcastAcrossBatch(bool broadcastAcrossBatch) noexcept
Set whether to enable broadcast of tensor across the batch.
Definition: NvInfer.h:342
DataType getType() const noexcept
Get the data type of a tensor.
Definition: NvInfer.h:289
apiv::VTensor * mImpl
Definition: NvInfer.h:517
float getDynamicRangeMin() const noexcept
Get minimum of dynamic range.
Definition: NvInfer.h:411
virtual ~ITensor() noexcept=default
void setDimensions(Dims dimensions) noexcept
Set the dimensions of a tensor.
Definition: NvInfer.h:249
const char * getName() const noexcept
Get the tensor name.
Definition: NvInfer.h:230
Dims getDimensions() const noexcept
Get the dimensions of a tensor.
Definition: NvInfer.h:262
TensorFormats getAllowedFormats() const noexcept
Get a bitmask of TensorFormat values that the tensor supports. For a shape tensor,...
Definition: NvInfer.h:453
Class to handle tactic timing info collected from builder.
Definition: NvInfer.h:7993
bool combine(const ITimingCache &inputCache, bool ignoreMismatch) noexcept
Combine input timing cache into local instance.
Definition: NvInfer.h:8030
virtual ~ITimingCache() noexcept=default
apiv::VTimingCache * mImpl
Definition: NvInfer.h:8046
bool reset() noexcept
Empty the timing cache.
Definition: NvInfer.h:8040
Layer that represents a TopK reduction.
Definition: NvInfer.h:4378
void setK(int32_t k) noexcept
Set the k value for the layer.
Definition: NvInfer.h:4407
void setReduceAxes(uint32_t reduceAxes) noexcept
Set which axes to reduce for the layer.
Definition: NvInfer.h:4427
TopKOperation getOperation() const noexcept
Get the operation for the layer.
Definition: NvInfer.h:4395
apiv::VTopKLayer * mImpl
Definition: NvInfer.h:4443
void setOperation(TopKOperation op) noexcept
Set the operation for the layer.
Definition: NvInfer.h:4385
int32_t getK() const noexcept
Get the k value for the layer.
Definition: NvInfer.h:4417
uint32_t getReduceAxes() const noexcept
Get the axes to reduce for the layer.
Definition: NvInfer.h:4437
virtual ~ITopKLayer() noexcept=default
Definition: NvInfer.h:5401
TripLimit getTripLimit() const noexcept
Definition: NvInfer.h:5403
virtual ~ITripLimitLayer() noexcept=default
Layer that represents an unary operation.
Definition: NvInfer.h:3682
void setOperation(UnaryOperation op) noexcept
Set the unary operation for the layer.
Definition: NvInfer.h:3691
apiv::VUnaryLayer * mImpl
Definition: NvInfer.h:3707
UnaryOperation getOperation() const noexcept
Get the unary operation for the layer.
Definition: NvInfer.h:3701
virtual ~IUnaryLayer() noexcept=default
An array of weights used as a layer parameter.
Definition: NvInferRuntime.h:163
The TensorRT API version 1 namespace.
uint32_t TacticSources
Represents a collection of one or more TacticSource values combine using bitwise-OR operations.
Definition: NvInferRuntime.h:1341
ResizeSelector
The coordinate selector when resize to single pixel output.
Definition: NvInfer.h:4761
@ kFORMULA
Use formula to map the original index.
@ kUPPER
Select the upper left pixel.
EngineCapability
List of supported engine capability flows.
Definition: NvInferRuntime.h:106
nvinfer1::IPluginRegistry * getBuilderPluginRegistry(nvinfer1::EngineCapability capability) noexcept
Return the plugin registry for the given capability or nullptr if no registry exists.
MemoryPoolType
The type for memory pools used by TensorRT.
Definition: NvInfer.h:8057
ScaleMode
Controls how shift, scale and power are applied in a Scale layer.
Definition: NvInfer.h:2141
@ kUNIFORM
Identical coefficients across all elements of the tensor.
@ kCHANNEL
Per-channel coefficients.
uint32_t QuantizationFlags
Represents one or more QuantizationFlag values using binary OR operations.
Definition: NvInfer.h:7874
constexpr int32_t EnumMax< RNNDirection >() noexcept
Definition: NvInfer.h:3238
constexpr int32_t EnumMax< BuilderFlag >() noexcept
Definition: NvInfer.h:7977
constexpr int32_t EnumMax< LayerType >() noexcept
Definition: NvInfer.h:140
constexpr int32_t EnumMax< RNNGateType >() noexcept
Definition: NvInfer.h:3299
constexpr int32_t EnumMax< CalibrationAlgoType >() noexcept
Definition: NvInfer.h:7437
UnaryOperation
Enumerates the unary operations that may be performed by a Unary layer.
Definition: NvInfer.h:3637
@ kCOSH
Hyperbolic cosine.
@ kACOSH
Inverse hyperbolic cosine.
@ kERF
Gauss error function.
@ kACOS
Inverse cosine.
@ kABS
Absolute value.
@ kSINH
Hyperbolic sine.
@ kROUND
Round to nearest even for float datatype.
@ kATANH
Inverse hyperbolic tangent.
@ kASINH
Inverse hyperbolic sine.
@ kSIGN
Sign, If input > 0, output 1; if input < 0, output -1; if input == 0, output 0.
@ kEXP
Exponentiation.
@ kATAN
Inverse tangent.
constexpr int32_t EnumMax< ReduceOperation >() noexcept
Definition: NvInfer.h:3744
constexpr int32_t EnumMax< TripLimit >() noexcept
Definition: NvInfer.h:5127
constexpr int32_t EnumMax< RNNInputMode >() noexcept
Definition: NvInfer.h:3270
RNNInputMode
Enumerates the RNN input modes that may occur with an RNN layer.
Definition: NvInfer.h:3259
@ kSKIP
No operation is performed on the first recurrent layer.
@ kLINEAR
Perform the normal matrix multiplication in the first recurrent layer.
ActivationType
Enumerates the types of activation to perform in an activation layer.
Definition: NvInfer.h:159
@ kSELU
Selu activation: x>0 ? beta * x : beta * (alpha*exp(x) - alpha)
@ kTANH
TanH activation.
@ kSCALED_TANH
Scaled tanh activation: alpha*tanh(beta*x)
@ kRELU
Rectified linear activation.
@ kELU
Elu activation: x>=0 ? x : alpha * (exp(x) - 1).
@ kLEAKY_RELU
LeakyRelu activation: x>=0 ? x : alpha * x.
@ kSOFTSIGN
Softsign activation: x / (1+|x|)
@ kHARD_SIGMOID
Hard sigmoid activation: max(0, min(1, alpha*x+beta))
@ kTHRESHOLDED_RELU
Thresholded ReLU activation: x>alpha ? x : 0.
@ kSIGMOID
Sigmoid activation.
@ kCLIP
Clip activation: max(alpha, min(beta, x))
@ kSOFTPLUS
Parametric softplus activation: alpha*log(exp(beta*x)+1)
FillOperation
Enumerates the tensor fill operations that may performed by a fill layer.
Definition: NvInfer.h:5606
@ kLINSPACE
Generate evenly spaced numbers over a specified interval.
@ kRANDOM_UNIFORM
Generate a tensor with random values drawn from a uniform distribution.
ResizeRoundMode
The rounding mode for nearest neighbor resize.
Definition: NvInfer.h:4791
@ kHALF_UP
Round half up.
@ kHALF_DOWN
Round half down.
RNNGateType
Identifies an individual gate within an RNN cell.
Definition: NvInfer.h:3283
@ kUPDATE
Update gate (z).
@ kHIDDEN
Hidden gate (h).
@ kFORGET
Forget gate (f).
@ kOUTPUT
Output gate (o).
@ kRESET
Reset gate (r).
@ kINPUT
Input gate (i).
@ kCELL
Cell gate (c).
PaddingMode
Enumerates the modes of padding to perform in convolution, deconvolution and pooling layer,...
Definition: NvInfer.h:988
@ kSAME_LOWER
Use SAME padding, with prePadding >= postPadding.
@ kEXPLICIT_ROUND_DOWN
Use explicit padding, rounding output size down.
@ kCAFFE_ROUND_DOWN
Use CAFFE padding, rounding output size down, uses prePadding value.
@ kEXPLICIT_ROUND_UP
Use explicit padding, rounding output size up.
@ kCAFFE_ROUND_UP
Use CAFFE padding, rounding output size up, uses prePadding value.
@ kSAME_UPPER
Use SAME padding, with prePadding <= postPadding.
TripLimit
Enum that describes kinds of trip limits.
Definition: NvInfer.h:5115
@ kWHILE
Tensor is a scalar of type kBOOL. Loop terminates when value is false.
@ kCOUNT
Tensor is scalar of type kINT32 that contains the trip count.
uint32_t NetworkDefinitionCreationFlags
Represents one or more NetworkDefinitionCreationFlag flags using binary OR operations....
Definition: NvInfer.h:8766
constexpr int32_t EnumMax< GatherMode >() noexcept
Definition: NvInfer.h:2954
DataType
The type of weights and tensors.
Definition: NvInferRuntimeCommon.h:151
uint32_t BuilderFlags
Represents one or more QuantizationFlag values using binary OR operations, e.g., 1U << BuilderFlag::k...
Definition: NvInfer.h:7908
DeviceType
The device that this layer/network will execute on.
Definition: NvInferRuntime.h:639
constexpr int32_t EnumMax< ScaleMode >() noexcept
Definition: NvInfer.h:2153
CalibrationAlgoType
Version of calibration algorithm to use.
Definition: NvInfer.h:7424
LayerType
The type values of layer classes.
Definition: NvInfer.h:90
@ kRAGGED_SOFTMAX
Ragged softmax layer.
@ kDECONVOLUTION
Deconvolution layer.
@ kREDUCE
Reduce layer.
@ kASSERTION
Assertion layer.
@ kTOPK
TopK layer.
@ kRESIZE
Resize Layer.
@ kPADDING
Padding layer.
@ kMATRIX_MULTIPLY
Matrix multiply layer.
@ kCONDITION
Condition layer.
@ kCONDITIONAL_INPUT
Conditional Input layer.
@ kIDENTITY
Identity layer.
@ kQUANTIZE
Quantize layer.
@ kSCATTER
Scatter layer.
@ kCONVOLUTION
Convolution layer.
@ kPARAMETRIC_RELU
Parametric ReLU layer.
@ kCONCATENATION
Concatenation layer.
@ kSLICE
Slice layer.
@ kEINSUM
Einsum layer.
@ kSOFTMAX
SoftMax layer.
@ kSHAPE
Shape layer.
@ kFULLY_CONNECTED
Fully connected layer.
@ kRECURRENCE
Loop Recurrence layer.
@ kDEQUANTIZE
Dequantize layer.
@ kSHUFFLE
Shuffle layer.
@ kITERATOR
Loop Iterator layer.
@ kPOOLING
Pooling layer.
@ kTRIP_LIMIT
Loop Trip limit layer.
@ kSCALE
Scale layer.
@ kGATHER
Gather layer.
@ kUNARY
UnaryOp operation Layer.
@ kACTIVATION
Activation layer.
@ kELEMENTWISE
Elementwise layer.
@ kSELECT
Select layer.
@ kPLUGIN_V2
PluginV2 layer.
@ kLOOP_OUTPUT
Loop output layer.
@ kCONDITIONAL_OUTPUT
Conditional Output layer.
@ kCONSTANT
Constant layer.
@ kRNN_V2
RNNv2 layer.
@ kFILL
Fill layer.
@ kPLUGIN
Plugin layer.
SliceMode
Controls how ISliceLayer handles out of bounds coordinates.
Definition: NvInfer.h:4135
@ kCLAMP
Out of bounds indices are clamped to bounds.
@ kWRAP
Coordinates wrap around periodically.
constexpr int32_t EnumMax< QuantizationFlag >() noexcept
Definition: NvInfer.h:7897
GatherMode
Control form of IGatherLayer.
Definition: NvInfer.h:2942
@ kDEFAULT
Similar to ONNX Gather.
@ kELEMENT
Similar to ONNX GatherElements.
@ kND
Similar to ONNX GatherND.
uint32_t TensorFormats
It is capable of representing one or more TensorFormat by binary OR operations, e....
Definition: NvInfer.h:151
ProfilingVerbosity
List of verbosity levels of layer information exposed in NVTX annotations and in IEngineInspector.
Definition: NvInferRuntime.h:1353
ResizeMode
Enumerates various modes of resize in the resize layer. Resize mode set using setResizeMode().
Definition: NvInfer.h:4680
@ kNEAREST
ND (0 < N <= 8) nearest neighbor resizing.
constexpr int32_t EnumMax< SliceMode >() noexcept
Definition: NvInfer.h:4151
NetworkDefinitionCreationFlag
List of immutable network properties expressed at network creation time. NetworkDefinitionCreationFla...
Definition: NvInfer.h:8778
ElementWiseOperation
Enumerates the binary operations that may be performed by an ElementWise layer.
Definition: NvInfer.h:2852
@ kSUB
Subtract the second element from the first.
@ kSUM
Sum of the two elements.
@ kPROD
Product of the two elements.
@ kFLOOR_DIV
Floor division of the first element by the second.
@ kEQUAL
Check if two elements are equal.
@ kAND
Logical AND of two elements.
@ kOR
Logical OR of two elements.
@ kMIN
Minimum of the two elements.
@ kPOW
The first element to the power of the second element.
@ kLESS
Check if element in first tensor is less than corresponding element in second tensor.
@ kGREATER
Check if element in first tensor is greater than corresponding element in second tensor.
@ kXOR
Logical XOR of two elements.
@ kDIV
Divide the first element by the second.
QuantizationFlag
List of valid flags for quantizing the network to int8.
Definition: NvInfer.h:7884
RNNDirection
Enumerates the RNN direction that may be performed by an RNN layer.
Definition: NvInfer.h:3227
@ kBIDIRECTION
Network iterates from first to last and vice versa and outputs concatenated.
@ kUNIDIRECTION
Network iterations from first input to last input.
BuilderFlag
List of valid modes that the builder can enable when creating an engine from a network definition.
Definition: NvInfer.h:7918
@ kDEBUG
Enable debugging of layers via synchronizing after every layer.
@ kGPU_FALLBACK
Enable layers marked to execute on GPU if layer cannot execute on DLA.
@ kSPARSE_WEIGHTS
Allow the builder to examine weights and use optimized functions when weights have suitable sparsity.
@ kFP16
Enable FP16 layer selection, with FP32 fallback.
@ kINT8
Enable Int8 layer selection, with FP32 fallback with FP16 fallback if kFP16 also specified.
@ kDISABLE_TIMING_CACHE
Disable reuse of timing information across identical layers.
@ kREFIT
Enable building a refittable engine.
@ kOBEY_PRECISION_CONSTRAINTS
Require that layers execute in specified precisions. Build fails otherwise.
@ kREJECT_EMPTY_ALGORITHMS
Fail if IAlgorithmSelector::selectAlgorithms returns an empty set of algorithms.
constexpr int32_t EnumMax< TopKOperation >() noexcept
Definition: NvInfer.h:4365
TensorFormat
Format of the input/output tensors.
Definition: NvInferRuntimeCommon.h:221
constexpr int32_t EnumMax< MemoryPoolType >() noexcept
Definition: NvInfer.h:8096
TopKOperation
Enumerates the operations that may be performed by a TopK layer.
Definition: NvInfer.h:4354
ReduceOperation
Enumerates the reduce operations that may be performed by a Reduce layer.
Definition: NvInfer.h:3730
constexpr int32_t EnumMax< LoopOutput >() noexcept
Definition: NvInfer.h:5108
RNNOperation
Enumerates the RNN operations that may be performed by an RNN layer.
Definition: NvInfer.h:3201
@ kGRU
Three-gate network consisting of Gated Recurrent Units.
@ kLSTM
Four-gate LSTM network w/o peephole connections.
constexpr int32_t EnumMax< NetworkDefinitionCreationFlag >() noexcept
Definition: NvInfer.h:8807
ScatterMode
Control form of IScatterLayer.
Definition: NvInfer.h:6047
MatrixOperation
Enumerates the operations that may be performed on a tensor by IMatrixMultiplyLayer before multiplica...
Definition: NvInfer.h:4454
@ kTRANSPOSE
Like kNONE, but transpose the matrix dimensions.
ResizeCoordinateTransformation
The resize coordinate transformation function.
Definition: NvInfer.h:4707
constexpr int32_t EnumMax< UnaryOperation >() noexcept
Definition: NvInfer.h:3669
LoopOutput
Enum that describes kinds of loop outputs.
Definition: NvInfer.h:5091
@ kLAST_VALUE
Output value is value of tensor for last iteration.
@ kCONCATENATE
Output value is concatenation of values of tensor for each iteration, in forward order.
@ kREVERSE
Output value is concatenation of values of tensor for each iteration, in reverse order.
constexpr int32_t EnumMax< MatrixOperation >() noexcept
Definition: NvInfer.h:4482
constexpr int32_t EnumMax< RNNOperation >() noexcept
Definition: NvInfer.h:3214
PoolingType
The type of pooling to perform in a pooling layer.
Definition: NvInfer.h:1671
constexpr int32_t EnumMax< FillOperation >() noexcept
Definition: NvInfer.h:5617
TensorLocation
The location for tensor data storage, device or host.
Definition: NvInferRuntime.h:253
OptProfileSelector
When setting or querying optimization profile parameters (such as shape tensor inputs or dynamic dime...
Definition: NvInferRuntime.h:1120
constexpr int32_t EnumMax< ScatterMode >() noexcept
Definition: NvInfer.h:6058
Definition: NvInfer.h:3947
Declaration of EnumMaxImpl struct to store maximum number of elements in an enumeration type.
Definition: NvInferRuntimeCommon.h:136