forked from NVIDIA/TensorRT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NvInferImpl.h
1205 lines (1121 loc) · 52.6 KB
/
NvInferImpl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* SPDX-FileCopyrightText: Copyright (c) 1993-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef NV_INFER_IMPL_H
#define NV_INFER_IMPL_H
#include "NvInferLegacyDims.h"
#include "NvInferRuntimeCommon.h"
// @cond SuppressDoxyWarnings
namespace nvinfer1
{
class IActivationLayer;
class IAlgorithm;
class IAlgorithmContext;
class IAlgorithmIOInfo;
class IAlgorithmSelector;
class IAlgorithmVariant;
class IAssertionLayer;
class IBuilder;
class IBuilderConfig;
class IConcatenationLayer;
class IConditionLayer;
class IConstantLayer;
class IConvolutionLayer;
class ICudaEngine;
class IDeconvolutionLayer;
class IDequantizeLayer;
class IDimensionExpr;
class IEinsumLayer;
class IElementWiseLayer;
class IEngineInspector;
class IExecutionContext;
class IFillLayer;
class IFullyConnectedLayer;
class IGatherLayer;
class IGridSampleLayer;
class IHostMemory;
class IIdentityLayer;
class ICastLayer;
class IIfConditional;
class IIfConditionalInputLayer;
class IIfConditionalOutputLayer;
class IInt8Calibrator;
class IIteratorLayer;
class ILayer;
class ILoop;
class ILoopOutputLayer;
class ILRNLayer;
class IMatrixMultiplyLayer;
class INetworkDefinition;
class INormalizationLayer;
class INMSLayer;
class INonZeroLayer;
class IOneHotLayer;
class IOptimizationProfile;
class IOutputAllocator;
class IPaddingLayer;
class IParametricReLULayer;
class IPlugin;
class IPluginExt;
class IPluginFactory;
class IPluginLayer;
class IPluginRegistry;
class IPluginV2Layer;
class IPoolingLayer;
class IProfiler;
class IQuantizeLayer;
class IRaggedSoftMaxLayer;
class IRecurrenceLayer;
class IReduceLayer;
class IResizeLayer;
class IReverseSequenceLayer;
class IRNNv2Layer;
class IRuntime;
class IScaleLayer;
class IScatterLayer;
class ISelectLayer;
class IShapeLayer;
class IShuffleLayer;
class ISliceLayer;
class ISoftMaxLayer;
class ITensor;
class ITimingCache;
class ITopKLayer;
class ITripLimitLayer;
class IUnaryLayer;
struct Permutation;
class Weights;
enum class ActivationType : int32_t;
enum class BoundingBoxFormat : int32_t;
enum class BuilderFlag : int32_t;
enum class CalibrationAlgoType : int32_t;
enum class DeviceType : int32_t;
enum class DimensionOperation : int32_t;
enum class ElementWiseOperation : int32_t;
enum class EngineCapability : int32_t;
enum class FillOperation : int32_t;
enum class GatherMode : int32_t;
enum class LayerInformationFormat : int32_t;
enum class LayerType : int32_t;
enum class LoopOutput : int32_t;
enum class MatrixOperation : int32_t;
enum class MemoryPoolType : int32_t;
enum class NetworkDefinitionCreationFlag : int32_t;
enum class OptProfileSelector : int32_t;
enum class PaddingMode : int32_t;
enum class PoolingType : int32_t;
enum class ProfilingVerbosity : int32_t;
enum class QuantizationFlag : int32_t;
enum class ReduceOperation : int32_t;
enum class ResizeCoordinateTransformation : int32_t;
enum class InterpolationMode : int32_t;
enum class ResizeRoundMode : int32_t;
enum class ResizeSelector : int32_t;
enum class RNNDirection : int32_t;
enum class RNNGateType : int32_t;
enum class RNNInputMode : int32_t;
enum class RNNOperation : int32_t;
enum class ScaleMode : int32_t;
enum class ScatterMode : int32_t;
enum class SampleMode : int32_t;
enum class TensorIOMode : int32_t;
enum class TensorLocation : int32_t;
enum class TopKOperation : int32_t;
enum class TripLimit : int32_t;
enum class UnaryOperation : int32_t;
enum class WeightsRole : int32_t;
enum class PreviewFeature : int32_t;
enum class HardwareCompatibilityLevel : int32_t;
using TacticSources = uint32_t;
using TensorFormats = uint32_t;
using BuilderFlags = uint32_t;
using NetworkDefinitionCreationFlags = uint32_t;
using QuantizationFlags = uint32_t;
using TempfileControlFlags = uint32_t;
using ResizeMode = InterpolationMode;
using SliceMode = SampleMode;
//!
//! \file NvInferImpl.h
//!
//! This file contains definitions for API methods that cross the shared library boundary. These
//! methods must not be called directly by applications; they should only be called through the
//! API classes.
//!
namespace apiv
{
class VRoot
{
public:
virtual ~VRoot() noexcept = default;
};
class VHostMemory : public VRoot
{
public:
virtual void* data() const noexcept = 0;
virtual std::size_t size() const noexcept = 0;
virtual DataType type() const noexcept = 0;
};
class VDimensionExpr : public VRoot
{
public:
virtual bool isConstant() const = 0;
virtual int32_t getConstantValue() const = 0;
};
class VExprBuilder : public VRoot
{
public:
virtual IDimensionExpr const* constant(int32_t value) = 0;
virtual IDimensionExpr const* operation(
DimensionOperation op, IDimensionExpr const& first, IDimensionExpr const& second)
= 0;
};
class VRuntime : public VRoot
{
public:
virtual nvinfer1::ICudaEngine* deserializeCudaEngine(
void const* blob, std::size_t size, IPluginFactory* pluginFactory) noexcept = 0;
virtual void setDLACore(int32_t dlaCore) noexcept = 0;
virtual int32_t getDLACore() const noexcept = 0;
virtual int32_t getNbDLACores() const noexcept = 0;
virtual void setGpuAllocator(IGpuAllocator* allocator) noexcept = 0;
virtual void setErrorRecorder(IErrorRecorder* recorder) noexcept = 0;
virtual IErrorRecorder* getErrorRecorder() const noexcept = 0;
virtual ILogger* getLogger() const noexcept = 0;
virtual bool setMaxThreads(int32_t maxThreads) noexcept = 0;
virtual int32_t getMaxThreads() const noexcept = 0;
virtual void setTemporaryDirectory(char const*) noexcept = 0;
virtual char const* getTemporaryDirectory() const noexcept = 0;
virtual void setTempfileControlFlags(TempfileControlFlags) noexcept = 0;
virtual TempfileControlFlags getTempfileControlFlags() const noexcept = 0;
virtual IRuntime* getPImpl() noexcept = 0;
virtual IPluginRegistry& getPluginRegistry() noexcept = 0;
virtual void setPluginRegistryParent(IPluginRegistry* parent) noexcept = 0;
virtual IRuntime* loadRuntime(char const* path) noexcept = 0;
virtual void setEngineHostCodeAllowed(bool allowed) noexcept = 0;
virtual bool getEngineHostCodeAllowed() const noexcept = 0;
};
class VRefitter : public VRoot
{
public:
virtual bool setWeights(char const* layerName, WeightsRole role, const Weights weights) noexcept = 0;
virtual bool refitCudaEngine() noexcept = 0;
virtual int32_t getMissing(int32_t size, char const** layerNames, WeightsRole* roles) noexcept = 0;
virtual int32_t getAll(int32_t size, char const** layerNames, WeightsRole* roles) noexcept = 0;
virtual bool setDynamicRange(char const* tensorName, float min, float max) noexcept = 0;
virtual float getDynamicRangeMin(char const* tensorName) const noexcept = 0;
virtual float getDynamicRangeMax(char const* tensorName) const noexcept = 0;
virtual int32_t getTensorsWithDynamicRange(int32_t size, char const** tensorNames) const noexcept = 0;
virtual void setErrorRecorder(IErrorRecorder* recorder) noexcept = 0;
virtual IErrorRecorder* getErrorRecorder() const noexcept = 0;
virtual bool setNamedWeights(char const* name, Weights weights) noexcept = 0;
virtual int32_t getMissingWeights(int32_t size, char const** weightsNames) noexcept = 0;
virtual int32_t getAllWeights(int32_t size, char const** weightsNames) noexcept = 0;
virtual ILogger* getLogger() const noexcept = 0;
virtual bool setMaxThreads(int32_t maxThreads) noexcept = 0;
virtual int32_t getMaxThreads() const noexcept = 0;
};
class VOptimizationProfile : public VRoot
{
public:
virtual bool setDimensions(char const* inputName, OptProfileSelector select, Dims dims) noexcept = 0;
virtual Dims getDimensions(char const* inputName, OptProfileSelector select) const noexcept = 0;
virtual bool setShapeValues(
char const* inputName, OptProfileSelector select, int32_t const* values, int32_t nbValues) noexcept = 0;
virtual int32_t getNbShapeValues(char const* inputName) const noexcept = 0;
virtual int32_t const* getShapeValues(char const* inputName, OptProfileSelector select) const noexcept = 0;
virtual bool setExtraMemoryTarget(float target) noexcept = 0;
virtual float getExtraMemoryTarget() const noexcept = 0;
virtual bool isValid() const noexcept = 0;
};
class VCudaEngine : public VRoot
{
public:
virtual int32_t getNbBindings() const noexcept = 0;
virtual int32_t getBindingIndex(char const* name) const noexcept = 0;
virtual char const* getBindingName(int32_t bindingIndex) const noexcept = 0;
virtual bool bindingIsInput(int32_t bindingIndex) const noexcept = 0;
virtual Dims getBindingDimensions(int32_t bindingIndex) const noexcept = 0;
virtual DataType getBindingDataType(int32_t bindingIndex) const noexcept = 0;
virtual int32_t getMaxBatchSize() const noexcept = 0;
virtual int32_t getNbLayers() const noexcept = 0;
virtual IHostMemory* serialize() const noexcept = 0;
virtual IExecutionContext* createExecutionContext() noexcept = 0;
virtual TensorLocation getLocation(int32_t bindingIndex) const noexcept = 0;
virtual IExecutionContext* createExecutionContextWithoutDeviceMemory() noexcept = 0;
virtual size_t getDeviceMemorySize() const noexcept = 0;
virtual bool isRefittable() const noexcept = 0;
virtual int32_t getBindingBytesPerComponent(int32_t bindingIndex) const noexcept = 0;
virtual int32_t getBindingComponentsPerElement(int32_t bindingIndex) const noexcept = 0;
virtual TensorFormat getBindingFormat(int32_t bindingIndex) const noexcept = 0;
virtual char const* getBindingFormatDesc(int32_t bindingIndex) const noexcept = 0;
virtual int32_t getBindingVectorizedDim(int32_t bindingIndex) const noexcept = 0;
virtual char const* getName() const noexcept = 0;
virtual int32_t getNbOptimizationProfiles() const noexcept = 0;
virtual Dims getProfileDimensions(
int32_t bindingIndex, int32_t profileIndex, OptProfileSelector select) const noexcept = 0;
virtual int32_t const* getProfileShapeValues(
int32_t profileIndex, int32_t inputIndex, OptProfileSelector select) const noexcept = 0;
virtual bool isShapeBinding(int32_t bindingIndex) const noexcept = 0;
virtual bool isExecutionBinding(int32_t bindingIndex) const noexcept = 0;
virtual EngineCapability getEngineCapability() const noexcept = 0;
virtual void setErrorRecorder(IErrorRecorder* recorder) noexcept = 0;
virtual IErrorRecorder* getErrorRecorder() const noexcept = 0;
virtual bool hasImplicitBatchDimension() const noexcept = 0;
virtual TacticSources getTacticSources() const noexcept = 0;
virtual ProfilingVerbosity getProfilingVerbosity() const noexcept = 0;
virtual IEngineInspector* createEngineInspector() const noexcept = 0;
virtual Dims getTensorShape(char const* tensorName) const noexcept = 0;
virtual DataType getTensorDataType(char const* tensorName) const noexcept = 0;
virtual TensorLocation getTensorLocation(char const* tensorName) const noexcept = 0;
virtual bool isShapeInferenceIO(char const* tensorName) const noexcept = 0;
virtual TensorIOMode getTensorIOMode(char const* tensorName) const noexcept = 0;
virtual int32_t getTensorBytesPerComponent(char const* tensorName) const noexcept = 0;
virtual int32_t getTensorComponentsPerElement(char const* tensorName) const noexcept = 0;
virtual TensorFormat getTensorFormat(char const* tensorName) const noexcept = 0;
virtual char const* getTensorFormatDesc(char const* tensorName) const noexcept = 0;
virtual int32_t getTensorVectorizedDim(char const* tensorName) const noexcept = 0;
virtual Dims getProfileShape(
char const* tensorName, int32_t profileIndex, OptProfileSelector select) const noexcept = 0;
virtual int32_t getNbIOTensors() const noexcept = 0;
virtual char const* getIOTensorName(int32_t index) const noexcept = 0;
virtual HardwareCompatibilityLevel getHardwareCompatibilityLevel() const noexcept = 0;
virtual ICudaEngine* getPImpl() noexcept = 0;
virtual int32_t getNbAuxStreams() const noexcept = 0;
virtual int32_t getTensorBytesPerComponentV2(char const* tensorName, int32_t profileIndex) const noexcept = 0;
virtual int32_t getTensorComponentsPerElementV2(char const* tensorName, int32_t profileIndex) const noexcept = 0;
virtual TensorFormat getTensorFormatV2(char const* tensorName, int32_t profileIndex) const noexcept = 0;
virtual char const* getTensorFormatDescV2(char const* tensorName, int32_t profileIndex) const noexcept = 0;
virtual int32_t getTensorVectorizedDimV2(char const* tensorName, int32_t profileIndex) const noexcept = 0;
};
class VExecutionContext : public VRoot
{
public:
virtual bool execute(int32_t batchSize, void* const* bindings) noexcept = 0;
virtual bool enqueue(
int32_t batchSize, void* const* bindings, cudaStream_t stream, cudaEvent_t* inputConsumed) noexcept
= 0;
virtual void setDebugSync(bool sync) noexcept = 0;
virtual bool getDebugSync() const noexcept = 0;
virtual void setProfiler(IProfiler*) noexcept = 0;
virtual IProfiler* getProfiler() const noexcept = 0;
virtual ICudaEngine const& getEngine() const noexcept = 0;
virtual void setName(char const* name) noexcept = 0;
virtual char const* getName() const noexcept = 0;
virtual void setDeviceMemory(void* memory) noexcept = 0;
virtual Dims getStrides(int32_t bindingIndex) const noexcept = 0;
virtual bool setOptimizationProfile(int32_t profileIndex) noexcept = 0;
virtual int32_t getOptimizationProfile() const noexcept = 0;
virtual bool setBindingDimensions(int32_t bindingIndex, Dims dimensions) noexcept = 0;
virtual Dims getBindingDimensions(int32_t bindingIndex) const noexcept = 0;
virtual bool setInputShapeBinding(int32_t bindingIndex, int32_t const* data) noexcept = 0;
virtual bool getShapeBinding(int32_t bindingIndex, int32_t* data) const noexcept = 0;
virtual bool allInputDimensionsSpecified() const noexcept = 0;
virtual bool allInputShapesSpecified() const noexcept = 0;
virtual void setErrorRecorder(IErrorRecorder* recorder) noexcept = 0;
virtual IErrorRecorder* getErrorRecorder() const noexcept = 0;
virtual bool executeV2(void* const* bindings) noexcept = 0;
virtual bool enqueueV2(void* const* bindings, cudaStream_t stream, cudaEvent_t* inputConsumed) noexcept = 0;
virtual bool setOptimizationProfileAsync(int32_t profileIndex, cudaStream_t stream) noexcept = 0;
virtual void setEnqueueEmitsProfile(bool enqueueEmitsProfile) noexcept = 0;
virtual bool getEnqueueEmitsProfile() const noexcept = 0;
virtual bool reportToProfiler() const noexcept = 0;
virtual bool setInputShape(char const* tensorName, Dims const& dims) noexcept = 0;
virtual Dims getTensorShape(char const* tensorName) const noexcept = 0;
virtual Dims getTensorStrides(char const* tensorName) const noexcept = 0;
virtual bool setTensorAddress(char const* tensorName, void* data) noexcept = 0;
virtual void const* getTensorAddress(char const* tensorName) const noexcept = 0;
virtual bool setInputTensorAddress(char const* tensorName, void const* data) noexcept = 0;
virtual int32_t inferShapes(int32_t nbMaxNames, char const** tensorNames) noexcept = 0;
virtual bool setInputConsumedEvent(cudaEvent_t event) noexcept = 0;
virtual cudaEvent_t getInputConsumedEvent() const noexcept = 0;
virtual void* getOutputTensorAddress(char const* tensorName) const noexcept = 0;
virtual bool setOutputAllocator(char const* tensorName, IOutputAllocator* outputAllocator) noexcept = 0;
virtual IOutputAllocator* getOutputAllocator(char const* name) noexcept = 0;
virtual int64_t getMaxOutputSize(char const* tensorName) const noexcept = 0;
virtual bool setTemporaryStorageAllocator(IGpuAllocator* allocator) noexcept = 0;
virtual IGpuAllocator* getTemporaryStorageAllocator() const noexcept = 0;
virtual bool enqueueV3(cudaStream_t stream) noexcept = 0;
virtual void setPersistentCacheLimit(size_t size) noexcept = 0;
virtual size_t getPersistentCacheLimit() const noexcept = 0;
virtual bool setNvtxVerbosity(ProfilingVerbosity verbosity) noexcept = 0;
virtual ProfilingVerbosity getNvtxVerbosity() const noexcept = 0;
virtual IExecutionContext* getPImpl() noexcept = 0;
virtual void setAuxStreams(cudaStream_t* auxStreams, int32_t nbStreams) noexcept = 0;
};
class VEngineInspector : public VRoot
{
public:
virtual bool setExecutionContext(IExecutionContext const* context) noexcept = 0;
virtual IExecutionContext const* getExecutionContext() const noexcept = 0;
virtual char const* getLayerInformation(int32_t layerIndex, LayerInformationFormat format) const noexcept = 0;
virtual char const* getEngineInformation(LayerInformationFormat format) const noexcept = 0;
virtual void setErrorRecorder(IErrorRecorder* recorder) noexcept = 0;
virtual IErrorRecorder* getErrorRecorder() const noexcept = 0;
virtual IEngineInspector* getPImpl() noexcept = 0;
};
class VTensor : public VRoot
{
public:
virtual void setName(char const* name) noexcept = 0;
virtual char const* getName() const noexcept = 0;
virtual void setDimensions(Dims dimensions) noexcept = 0;
virtual Dims getDimensions() const noexcept = 0;
virtual void setType(DataType type) noexcept = 0;
virtual DataType getType() const noexcept = 0;
virtual bool setDynamicRange(float min, float max) noexcept = 0;
virtual bool isNetworkInput() const noexcept = 0;
virtual bool isNetworkOutput() const noexcept = 0;
virtual void setBroadcastAcrossBatch(bool broadcastAcrossBatch) noexcept = 0;
virtual bool getBroadcastAcrossBatch() const noexcept = 0;
virtual TensorLocation getLocation() const noexcept = 0;
virtual void setLocation(TensorLocation location) noexcept = 0;
virtual bool dynamicRangeIsSet() const noexcept = 0;
virtual void resetDynamicRange() noexcept = 0;
virtual float getDynamicRangeMin() const noexcept = 0;
virtual float getDynamicRangeMax() const noexcept = 0;
virtual void setAllowedFormats(TensorFormats formats) noexcept = 0;
virtual TensorFormats getAllowedFormats() const noexcept = 0;
virtual bool isShapeTensor() const noexcept = 0;
virtual bool isExecutionTensor() const noexcept = 0;
virtual void setDimensionName(int32_t index, char const* name) noexcept = 0;
virtual char const* getDimensionName(int32_t index) const noexcept = 0;
};
class VLayer : public VRoot
{
public:
virtual LayerType getType() const noexcept = 0;
virtual void setName(char const* name) noexcept = 0;
virtual char const* getName() const noexcept = 0;
virtual int32_t getNbInputs() const noexcept = 0;
virtual ITensor* getInput(int32_t index) const noexcept = 0;
virtual int32_t getNbOutputs() const noexcept = 0;
virtual ITensor* getOutput(int32_t index) const noexcept = 0;
virtual void setInput(int32_t index, ITensor& tensor) noexcept = 0;
virtual void setPrecision(DataType dataType) noexcept = 0;
virtual DataType getPrecision() const noexcept = 0;
virtual bool precisionIsSet() const noexcept = 0;
virtual void resetPrecision() noexcept = 0;
virtual void setOutputType(int32_t index, DataType dataType) noexcept = 0;
virtual DataType getOutputType(int32_t index) const noexcept = 0;
virtual bool outputTypeIsSet(int32_t index) const noexcept = 0;
virtual void resetOutputType(int32_t index) noexcept = 0;
virtual void setMetadata(char const* docString) noexcept = 0;
virtual char const* getMetadata() const noexcept = 0;
};
class VConvolutionLayer : public VRoot
{
public:
virtual void setKernelSize(DimsHW kernelSize) noexcept = 0;
virtual DimsHW getKernelSize() const noexcept = 0;
virtual void setNbOutputMaps(int32_t nbOutputMaps) noexcept = 0;
virtual int32_t getNbOutputMaps() const noexcept = 0;
virtual void setStride(DimsHW stride) noexcept = 0;
virtual DimsHW getStride() const noexcept = 0;
virtual void setPadding(DimsHW padding) noexcept = 0;
virtual DimsHW getPadding() const noexcept = 0;
virtual void setNbGroups(int32_t nbGroups) noexcept = 0;
virtual int32_t getNbGroups() const noexcept = 0;
virtual void setKernelWeights(Weights weights) noexcept = 0;
virtual Weights getKernelWeights() const noexcept = 0;
virtual void setBiasWeights(Weights weights) noexcept = 0;
virtual Weights getBiasWeights() const noexcept = 0;
virtual void setDilation(DimsHW dilation) noexcept = 0;
virtual DimsHW getDilation() const noexcept = 0;
virtual void setPrePadding(Dims padding) noexcept = 0;
virtual Dims getPrePadding() const noexcept = 0;
virtual void setPostPadding(Dims padding) noexcept = 0;
virtual Dims getPostPadding() const noexcept = 0;
virtual void setPaddingMode(PaddingMode paddingMode) noexcept = 0;
virtual PaddingMode getPaddingMode() const noexcept = 0;
virtual void setKernelSizeNd(Dims kernelSize) noexcept = 0;
virtual Dims getKernelSizeNd() const noexcept = 0;
virtual void setStrideNd(Dims stride) noexcept = 0;
virtual Dims getStrideNd() const noexcept = 0;
virtual void setPaddingNd(Dims padding) noexcept = 0;
virtual Dims getPaddingNd() const noexcept = 0;
virtual void setDilationNd(Dims dilation) noexcept = 0;
virtual Dims getDilationNd() const noexcept = 0;
};
class VFullyConnectedLayer : public VRoot
{
public:
virtual void setNbOutputChannels(int32_t nbOutputs) noexcept = 0;
virtual int32_t getNbOutputChannels() const noexcept = 0;
virtual void setKernelWeights(Weights weights) noexcept = 0;
virtual Weights getKernelWeights() const noexcept = 0;
virtual void setBiasWeights(Weights weights) noexcept = 0;
virtual Weights getBiasWeights() const noexcept = 0;
};
class VActivationLayer : public VRoot
{
public:
virtual void setActivationType(ActivationType type) noexcept = 0;
virtual ActivationType getActivationType() const noexcept = 0;
virtual void setAlpha(float alpha) noexcept = 0;
virtual void setBeta(float beta) noexcept = 0;
virtual float getAlpha() const noexcept = 0;
virtual float getBeta() const noexcept = 0;
};
class VPoolingLayer : public VRoot
{
public:
virtual void setPoolingType(PoolingType type) noexcept = 0;
virtual PoolingType getPoolingType() const noexcept = 0;
virtual void setWindowSize(DimsHW windowSize) noexcept = 0;
virtual DimsHW getWindowSize() const noexcept = 0;
virtual void setStride(DimsHW stride) noexcept = 0;
virtual DimsHW getStride() const noexcept = 0;
virtual void setPadding(DimsHW padding) noexcept = 0;
virtual DimsHW getPadding() const noexcept = 0;
virtual void setBlendFactor(float blendFactor) noexcept = 0;
virtual float getBlendFactor() const noexcept = 0;
virtual void setAverageCountExcludesPadding(bool exclusive) noexcept = 0;
virtual bool getAverageCountExcludesPadding() const noexcept = 0;
virtual void setPrePadding(Dims padding) noexcept = 0;
virtual Dims getPrePadding() const noexcept = 0;
virtual void setPostPadding(Dims padding) noexcept = 0;
virtual Dims getPostPadding() const noexcept = 0;
virtual void setPaddingMode(PaddingMode paddingMode) noexcept = 0;
virtual PaddingMode getPaddingMode() const noexcept = 0;
virtual void setWindowSizeNd(Dims windowSize) noexcept = 0;
virtual Dims getWindowSizeNd() const noexcept = 0;
virtual void setStrideNd(Dims stride) noexcept = 0;
virtual Dims getStrideNd() const noexcept = 0;
virtual void setPaddingNd(Dims padding) noexcept = 0;
virtual Dims getPaddingNd() const noexcept = 0;
};
class VLRNLayer : public VRoot
{
public:
virtual void setWindowSize(int32_t windowSize) noexcept = 0;
virtual int32_t getWindowSize() const noexcept = 0;
virtual void setAlpha(float alpha) noexcept = 0;
virtual float getAlpha() const noexcept = 0;
virtual void setBeta(float beta) noexcept = 0;
virtual float getBeta() const noexcept = 0;
virtual void setK(float k) noexcept = 0;
virtual float getK() const noexcept = 0;
};
class VScaleLayer : public VRoot
{
public:
virtual void setMode(ScaleMode mode) noexcept = 0;
virtual ScaleMode getMode() const noexcept = 0;
virtual void setShift(Weights shift) noexcept = 0;
virtual Weights getShift() const noexcept = 0;
virtual void setScale(Weights scale) noexcept = 0;
virtual Weights getScale() const noexcept = 0;
virtual void setPower(Weights power) noexcept = 0;
virtual Weights getPower() const noexcept = 0;
virtual int32_t getChannelAxis() const noexcept = 0;
virtual void setChannelAxis(int32_t channelAxis) noexcept = 0;
};
class VSoftMaxLayer : public VRoot
{
public:
virtual void setAxes(uint32_t axes) noexcept = 0;
virtual uint32_t getAxes() const noexcept = 0;
};
class VConcatenationLayer : public VRoot
{
public:
virtual void setAxis(int32_t axis) noexcept = 0;
virtual int32_t getAxis() const noexcept = 0;
};
class VDeconvolutionLayer : public VRoot
{
public:
virtual void setKernelSize(DimsHW kernelSize) noexcept = 0;
virtual DimsHW getKernelSize() const noexcept = 0;
virtual void setNbOutputMaps(int32_t nbOutputMaps) noexcept = 0;
virtual int32_t getNbOutputMaps() const noexcept = 0;
virtual void setStride(DimsHW stride) noexcept = 0;
virtual DimsHW getStride() const noexcept = 0;
virtual void setPadding(DimsHW padding) noexcept = 0;
virtual DimsHW getPadding() const noexcept = 0;
virtual void setNbGroups(int32_t nbGroups) noexcept = 0;
virtual int32_t getNbGroups() const noexcept = 0;
virtual void setKernelWeights(Weights weights) noexcept = 0;
virtual Weights getKernelWeights() const noexcept = 0;
virtual void setBiasWeights(Weights weights) noexcept = 0;
virtual Weights getBiasWeights() const noexcept = 0;
virtual void setPrePadding(Dims padding) noexcept = 0;
virtual Dims getPrePadding() const noexcept = 0;
virtual void setPostPadding(Dims padding) noexcept = 0;
virtual Dims getPostPadding() const noexcept = 0;
virtual void setPaddingMode(PaddingMode paddingMode) noexcept = 0;
virtual PaddingMode getPaddingMode() const noexcept = 0;
virtual void setKernelSizeNd(Dims kernelSize) noexcept = 0;
virtual Dims getKernelSizeNd() const noexcept = 0;
virtual void setStrideNd(Dims stride) noexcept = 0;
virtual Dims getStrideNd() const noexcept = 0;
virtual void setPaddingNd(Dims padding) noexcept = 0;
virtual Dims getPaddingNd() const noexcept = 0;
virtual void setDilationNd(Dims dilation) noexcept = 0;
virtual Dims getDilationNd() const noexcept = 0;
};
class VElementWiseLayer : public VRoot
{
public:
virtual void setOperation(ElementWiseOperation op) noexcept = 0;
virtual ElementWiseOperation getOperation() const noexcept = 0;
};
class VGatherLayer : public VRoot
{
public:
virtual void setGatherAxis(int32_t axis) noexcept = 0;
virtual int32_t getGatherAxis() const noexcept = 0;
virtual void setNbElementWiseDims(int32_t k) noexcept = 0;
virtual int32_t getNbElementWiseDims() const noexcept = 0;
virtual void setMode(GatherMode mode) noexcept = 0;
virtual GatherMode getMode() const noexcept = 0;
};
class VRNNv2Layer : public VRoot
{
public:
virtual int32_t getLayerCount() const noexcept = 0;
virtual int32_t getHiddenSize() const noexcept = 0;
virtual int32_t getMaxSeqLength() const noexcept = 0;
virtual int32_t getDataLength() const noexcept = 0;
virtual void setSequenceLengths(ITensor& seqLengths) noexcept = 0;
virtual ITensor* getSequenceLengths() const noexcept = 0;
virtual void setOperation(RNNOperation op) noexcept = 0;
virtual RNNOperation getOperation() const noexcept = 0;
virtual void setInputMode(RNNInputMode op) noexcept = 0;
virtual RNNInputMode getInputMode() const noexcept = 0;
virtual void setDirection(RNNDirection op) noexcept = 0;
virtual RNNDirection getDirection() const noexcept = 0;
virtual void setWeightsForGate(int32_t layerIndex, RNNGateType gate, bool isW, Weights weights) noexcept = 0;
virtual Weights getWeightsForGate(int32_t layerIndex, RNNGateType gate, bool isW) const noexcept = 0;
virtual void setBiasForGate(int32_t layerIndex, RNNGateType gate, bool isW, Weights bias) noexcept = 0;
virtual Weights getBiasForGate(int32_t layerIndex, RNNGateType gate, bool isW) const noexcept = 0;
virtual void setHiddenState(ITensor& hidden) noexcept = 0;
virtual ITensor* getHiddenState() const noexcept = 0;
virtual void setCellState(ITensor& cell) noexcept = 0;
virtual ITensor* getCellState() const noexcept = 0;
};
class VPluginLayer : public VRoot
{
public:
virtual IPlugin& getPlugin() noexcept = 0;
};
class VPluginV2Layer : public VRoot
{
public:
virtual IPluginV2& getPlugin() noexcept = 0;
};
class VUnaryLayer : public VRoot
{
public:
virtual void setOperation(UnaryOperation op) noexcept = 0;
virtual UnaryOperation getOperation() const noexcept = 0;
};
class VReduceLayer : public VRoot
{
public:
virtual void setOperation(ReduceOperation op) noexcept = 0;
virtual ReduceOperation getOperation() const noexcept = 0;
virtual void setReduceAxes(uint32_t reduceAxes) noexcept = 0;
virtual uint32_t getReduceAxes() const noexcept = 0;
virtual void setKeepDimensions(bool keepDimensions) noexcept = 0;
virtual bool getKeepDimensions() const noexcept = 0;
};
class VPaddingLayer : public VRoot
{
public:
virtual void setPrePadding(DimsHW padding) noexcept = 0;
virtual DimsHW getPrePadding() const noexcept = 0;
virtual void setPostPadding(DimsHW padding) noexcept = 0;
virtual DimsHW getPostPadding() const noexcept = 0;
virtual void setPrePaddingNd(Dims padding) noexcept = 0;
virtual Dims getPrePaddingNd() const noexcept = 0;
virtual void setPostPaddingNd(Dims padding) noexcept = 0;
virtual Dims getPostPaddingNd() const noexcept = 0;
};
class VShuffleLayer : public VRoot
{
public:
virtual void setFirstTranspose(Permutation const& permutation) noexcept = 0;
virtual Permutation const& getFirstTranspose() const noexcept = 0;
virtual void setReshapeDimensions(Dims dimensions) noexcept = 0;
virtual Dims getReshapeDimensions() const noexcept = 0;
virtual void setSecondTranspose(Permutation const& permutation) noexcept = 0;
virtual Permutation const& getSecondTranspose() const noexcept = 0;
virtual void setZeroIsPlaceholder(bool zeroIsPlaceholder) noexcept = 0;
virtual bool getZeroIsPlaceholder() const noexcept = 0;
};
class VSliceLayer : public VRoot
{
public:
virtual void setStart(Dims start) noexcept = 0;
virtual Dims getStart() const noexcept = 0;
virtual void setSize(Dims size) noexcept = 0;
virtual Dims getSize() const noexcept = 0;
virtual void setStride(Dims stride) noexcept = 0;
virtual Dims getStride() const noexcept = 0;
virtual void setMode(SliceMode mode) noexcept = 0;
virtual SliceMode getMode() const noexcept = 0;
};
class VShapeLayer : public VRoot
{
public:
};
class VTopKLayer : public VRoot
{
public:
virtual void setOperation(TopKOperation op) noexcept = 0;
virtual TopKOperation getOperation() const noexcept = 0;
virtual void setK(int32_t k) noexcept = 0;
virtual int32_t getK() const noexcept = 0;
virtual void setReduceAxes(uint32_t reduceAxes) noexcept = 0;
virtual uint32_t getReduceAxes() const noexcept = 0;
};
class VMatrixMultiplyLayer : public VRoot
{
public:
virtual void setOperation(int32_t index, MatrixOperation op) noexcept = 0;
virtual MatrixOperation getOperation(int32_t index) const noexcept = 0;
};
class VNonZeroLayer : public VRoot
{
public:
};
class VRaggedSoftMaxLayer : public VRoot
{
public:
};
class VIdentityLayer : public VRoot
{
public:
};
class VCastLayer : public VRoot
{
public:
virtual void setToType(DataType toType) noexcept = 0;
virtual DataType getToType() const noexcept = 0;
};
class VConstantLayer : public VRoot
{
public:
virtual void setWeights(Weights weights) noexcept = 0;
virtual Weights getWeights() const noexcept = 0;
virtual void setDimensions(Dims dimensions) noexcept = 0;
virtual Dims getDimensions() const noexcept = 0;
};
class VParametricReLULayer : public VRoot
{
public:
};
class VResizeLayer : public VRoot
{
public:
virtual void setOutputDimensions(Dims dimensions) noexcept = 0;
virtual Dims getOutputDimensions() const noexcept = 0;
virtual void setScales(float const* scales, int32_t nbScales) noexcept = 0;
virtual int32_t getScales(int32_t size, float* scales) const noexcept = 0;
virtual void setResizeMode(ResizeMode resizeMode) noexcept = 0;
virtual ResizeMode getResizeMode() const noexcept = 0;
virtual void setAlignCorners(bool alignCorners) noexcept = 0;
virtual bool getAlignCorners() const noexcept = 0;
virtual void setCoordinateTransformation(ResizeCoordinateTransformation coordTransform) noexcept = 0;
virtual ResizeCoordinateTransformation getCoordinateTransformation() const noexcept = 0;
virtual void setSelectorForSinglePixel(ResizeSelector selector) noexcept = 0;
virtual ResizeSelector getSelectorForSinglePixel() const noexcept = 0;
virtual void setNearestRounding(ResizeRoundMode value) noexcept = 0;
virtual ResizeRoundMode getNearestRounding() const noexcept = 0;
virtual void setCubicCoeff(float value) noexcept = 0;
virtual float getCubicCoeff() const noexcept = 0;
virtual void setExcludeOutside(bool value) noexcept = 0;
virtual bool getExcludeOutside() const noexcept = 0;
};
class VLoopBoundaryLayer : public VRoot
{
public:
virtual ILoop* getLoop() const noexcept = 0;
};
class VRecurrenceLayer : public VRoot
{
public:
};
class VLoopOutputLayer : public VRoot
{
public:
virtual LoopOutput getLoopOutput() const noexcept = 0;
virtual void setAxis(int32_t axis) noexcept = 0;
virtual int32_t getAxis() const noexcept = 0;
};
class VTripLimitLayer : public VRoot
{
public:
virtual TripLimit getTripLimit() const noexcept = 0;
};
class VIteratorLayer : public VRoot
{
public:
virtual void setAxis(int32_t axis) noexcept = 0;
virtual int32_t getAxis() const noexcept = 0;
virtual void setReverse(bool reverse) noexcept = 0;
virtual bool getReverse() const noexcept = 0;
};
class VLoop : public VRoot
{
public:
virtual IRecurrenceLayer* addRecurrence(ITensor& initialValue) noexcept = 0;
virtual ITripLimitLayer* addTripLimit(ITensor& tensor, TripLimit limit) noexcept = 0;
virtual IIteratorLayer* addIterator(ITensor& tensor, int32_t axis = 0, bool reverse = false) noexcept = 0;
virtual ILoopOutputLayer* addLoopOutput(ITensor& tensor, LoopOutput outputKind, int32_t axis = 0) noexcept = 0;
virtual void setName(char const* name) noexcept = 0;
virtual char const* getName() const noexcept = 0;
};
class VConditionalBoundaryLayer : public VRoot
{
public:
virtual IIfConditional* getConditional() const noexcept = 0;
};
class VConditionLayer : public VRoot
{
public:
};
class VConditionalInputLayer : public VRoot
{
public:
};
class VConditionalOutputLayer : public VRoot
{
public:
};
class VIfConditional : public VRoot
{
public:
virtual IConditionLayer* setCondition(ITensor& tensor) noexcept = 0;
virtual IIfConditionalInputLayer* addInput(ITensor& tensor) noexcept = 0;
virtual IIfConditionalOutputLayer* addOutput(ITensor& trueTensor, ITensor& falseTensor) noexcept = 0;
virtual void setName(char const* name) noexcept = 0;
virtual char const* getName() const noexcept = 0;
};
class VSelectLayer : public VRoot
{
};
class VAssertionLayer : public VRoot
{
public:
virtual void setMessage(char const* message) noexcept = 0;
virtual char const* getMessage() const noexcept = 0;
};
class VFillLayer : public VRoot
{
public:
virtual void setDimensions(Dims dimensions) noexcept = 0;
virtual Dims getDimensions() const noexcept = 0;
virtual void setOperation(FillOperation op) noexcept = 0;
virtual FillOperation getOperation() const noexcept = 0;
virtual void setAlpha(double alpha) noexcept = 0;
virtual double getAlpha() const noexcept = 0;
virtual void setBeta(double beta) noexcept = 0;
virtual double getBeta() const noexcept = 0;
};
class VQuantizeLayer : public VRoot
{
public:
virtual int32_t getAxis() const noexcept = 0;
virtual void setAxis(int32_t axis) noexcept = 0;
};
class VDequantizeLayer : public VRoot
{
public:
virtual int32_t getAxis() const noexcept = 0;
virtual void setAxis(int32_t axis) noexcept = 0;
};
class VScatterLayer : public VRoot
{
public:
virtual void setMode(ScatterMode mode) noexcept = 0;
virtual ScatterMode getMode() const noexcept = 0;
virtual void setAxis(int32_t axis) noexcept = 0;
virtual int32_t getAxis() const noexcept = 0;
}; // class VScatterLayer
class VEinsumLayer : public VRoot
{
public:
virtual bool setEquation(char const* equation) noexcept = 0;
virtual char const* getEquation() const noexcept = 0;
};
class VOneHotLayer : public VRoot
{
public:
virtual int32_t getAxis() const noexcept = 0;
virtual void setAxis(int32_t axis) noexcept = 0;
}; // class VOneHotLayer
class VGridSampleLayer : public VRoot
{
public:
virtual void setInterpolationMode(InterpolationMode mode) noexcept = 0;
virtual InterpolationMode getInterpolationMode() const noexcept = 0;
virtual void setAlignCorners(bool alignCorners) noexcept = 0;
virtual bool getAlignCorners() const noexcept = 0;
virtual bool setSampleMode(SampleMode mode) noexcept = 0;
virtual SampleMode getSampleMode() const noexcept = 0;
}; // class VGridSampleLayer
class VNMSLayer : public VRoot
{
public:
virtual void setBoundingBoxFormat(BoundingBoxFormat fmt) noexcept = 0;
virtual BoundingBoxFormat getBoundingBoxFormat() const noexcept = 0;
virtual void setTopKBoxLimit(int32_t limit) noexcept = 0;
virtual int32_t getTopKBoxLimit() const noexcept = 0;
}; // class VNMSLayer
class VReverseSequenceLayer : public VRoot
{
public:
virtual void setBatchAxis(int32_t batchAxis) noexcept = 0;
virtual int32_t getBatchAxis() const noexcept = 0;
virtual void setSequenceAxis(int32_t sequenceAxis) noexcept = 0;
virtual int32_t getSequenceAxis() const noexcept = 0;
}; // class VReverseSequenceLayer
class VNormalizationLayer : public VRoot
{
public:
virtual void setEpsilon(float eps) noexcept = 0;
virtual float getEpsilon() const noexcept = 0;
virtual void setAxes(uint32_t axesMask) noexcept = 0;
virtual uint32_t getAxes() const noexcept = 0;
virtual void setNbGroups(int32_t nbGroups) noexcept = 0;
virtual int32_t getNbGroups() const noexcept = 0;
virtual void setComputePrecision(DataType type) noexcept = 0;
virtual DataType getComputePrecision() const noexcept = 0;
}; // class VNormalizationLayer
class VNetworkDefinition : public VRoot
{
public:
virtual ITensor* addInput(char const* name, DataType type, Dims dimensions) noexcept = 0;
virtual void markOutput(ITensor& tensor) noexcept = 0;
virtual IConvolutionLayer* addConvolution(ITensor& input, int32_t nbOutputMaps, DimsHW kernelSize,
Weights kernelWeights, Weights biasWeights) noexcept = 0;
virtual IFullyConnectedLayer* addFullyConnected(
ITensor& input, int32_t nbOutputs, Weights kernelWeights, Weights biasWeights) noexcept
= 0;
virtual IActivationLayer* addActivation(ITensor& input, ActivationType type) noexcept = 0;
virtual IPoolingLayer* addPooling(ITensor& input, PoolingType type, DimsHW windowSize) noexcept = 0;
virtual ILRNLayer* addLRN(ITensor& input, int32_t window, float alpha, float beta, float k) noexcept = 0;
virtual IScaleLayer* addScale(ITensor& input, ScaleMode mode, Weights shift, Weights scale, Weights power) noexcept
= 0;
virtual ISoftMaxLayer* addSoftMax(ITensor& input) noexcept = 0;
virtual IConcatenationLayer* addConcatenation(ITensor* const* inputs, int32_t nbInputs) noexcept = 0;
virtual IDeconvolutionLayer* addDeconvolution(
ITensor& input, int32_t nbOutputMaps, DimsHW kernelSize, Weights kernelWeights, Weights biasWeights) noexcept
= 0;
virtual IElementWiseLayer* addElementWise(ITensor& input1, ITensor& input2, ElementWiseOperation op) noexcept = 0;
virtual IUnaryLayer* addUnary(ITensor& input, UnaryOperation operation) noexcept = 0;
virtual IPaddingLayer* addPadding(ITensor& input, DimsHW prePadding, DimsHW postPadding) noexcept = 0;
virtual IShuffleLayer* addShuffle(ITensor& input) noexcept = 0;
virtual int32_t getNbLayers() const noexcept = 0;
virtual ILayer* getLayer(int32_t index) const noexcept = 0;
virtual int32_t getNbInputs() const noexcept = 0;