forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 4
/
NativeMethods.shared.cs
2087 lines (1730 loc) · 135 KB
/
NativeMethods.shared.cs
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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Runtime.InteropServices;
namespace Microsoft.ML.OnnxRuntime
{
[StructLayout(LayoutKind.Sequential)]
public struct OrtApiBase
{
public IntPtr GetApi;
public IntPtr GetVersionString;
};
// NOTE: The order of the APIs in this struct should match exactly that in
// OrtApi ort_api_1_to_<latest_version> (onnxruntime/core/session/onnxruntime_c_api.cc)
// If syncing your new C API, any other C APIs before yours also need to be synced here if haven't
[StructLayout(LayoutKind.Sequential)]
public struct OrtApi
{
public IntPtr CreateStatus;
public IntPtr GetErrorCode;
public IntPtr GetErrorMessage;
public IntPtr CreateEnv;
public IntPtr CreateEnvWithCustomLogger;
public IntPtr EnableTelemetryEvents;
public IntPtr DisableTelemetryEvents;
public IntPtr CreateSession;
public IntPtr CreateSessionFromArray;
public IntPtr Run;
public IntPtr CreateSessionOptions;
public IntPtr SetOptimizedModelFilePath;
public IntPtr CloneSessionOptions;
public IntPtr SetSessionExecutionMode;
public IntPtr EnableProfiling;
public IntPtr DisableProfiling;
public IntPtr EnableMemPattern;
public IntPtr DisableMemPattern;
public IntPtr EnableCpuMemArena;
public IntPtr DisableCpuMemArena;
public IntPtr SetSessionLogId;
public IntPtr SetSessionLogVerbosityLevel;
public IntPtr SetSessionLogSeverityLevel;
public IntPtr SetSessionGraphOptimizationLevel;
public IntPtr SetIntraOpNumThreads;
public IntPtr SetInterOpNumThreads;
public IntPtr CreateCustomOpDomain;
public IntPtr CustomOpDomain_Add;
public IntPtr AddCustomOpDomain;
public IntPtr RegisterCustomOpsLibrary;
public IntPtr SessionGetInputCount;
public IntPtr SessionGetOutputCount;
public IntPtr SessionGetOverridableInitializerCount;
public IntPtr SessionGetInputTypeInfo;
public IntPtr SessionGetOutputTypeInfo;
public IntPtr SessionGetOverridableInitializerTypeInfo;
public IntPtr SessionGetInputName;
public IntPtr SessionGetOutputName;
public IntPtr SessionGetOverridableInitializerName;
public IntPtr CreateRunOptions;
public IntPtr RunOptionsSetRunLogVerbosityLevel;
public IntPtr RunOptionsSetRunLogSeverityLevel;
public IntPtr RunOptionsSetRunTag;
public IntPtr RunOptionsGetRunLogVerbosityLevel;
public IntPtr RunOptionsGetRunLogSeverityLevel;
public IntPtr RunOptionsGetRunTag;
public IntPtr RunOptionsSetTerminate;
public IntPtr RunOptionsUnsetTerminate;
public IntPtr CreateTensorAsOrtValue;
public IntPtr CreateTensorWithDataAsOrtValue;
public IntPtr IsTensor;
public IntPtr GetTensorMutableData;
public IntPtr FillStringTensor;
public IntPtr GetStringTensorDataLength;
public IntPtr GetStringTensorContent;
public IntPtr CastTypeInfoToTensorInfo;
public IntPtr GetOnnxTypeFromTypeInfo;
public IntPtr CreateTensorTypeAndShapeInfo;
public IntPtr SetTensorElementType;
public IntPtr SetDimensions;
public IntPtr GetTensorElementType;
public IntPtr GetDimensionsCount;
public IntPtr GetDimensions;
public IntPtr GetSymbolicDimensions;
public IntPtr GetTensorShapeElementCount;
public IntPtr GetTensorTypeAndShape;
public IntPtr GetTypeInfo;
public IntPtr GetValueType;
public IntPtr CreateMemoryInfo;
public IntPtr CreateCpuMemoryInfo;
public IntPtr CompareMemoryInfo;
public IntPtr MemoryInfoGetName;
public IntPtr MemoryInfoGetId;
public IntPtr MemoryInfoGetMemType;
public IntPtr MemoryInfoGetType;
public IntPtr AllocatorAlloc;
public IntPtr AllocatorFree;
public IntPtr AllocatorGetInfo;
public IntPtr GetAllocatorWithDefaultOptions;
public IntPtr AddFreeDimensionOverride;
public IntPtr GetValue;
public IntPtr GetValueCount;
public IntPtr CreateValue;
public IntPtr CreateOpaqueValue;
public IntPtr GetOpaqueValue;
public IntPtr KernelInfoGetAttribute_float;
public IntPtr KernelInfoGetAttribute_int64;
public IntPtr KernelInfoGetAttribute_string;
public IntPtr KernelContext_GetInputCount;
public IntPtr KernelContext_GetOutputCount;
public IntPtr KernelContext_GetInput;
public IntPtr KernelContext_GetOutput;
public IntPtr ReleaseEnv;
public IntPtr ReleaseStatus;
public IntPtr ReleaseMemoryInfo;
public IntPtr ReleaseSession;
public IntPtr ReleaseValue;
public IntPtr ReleaseRunOptions;
public IntPtr ReleaseTypeInfo;
public IntPtr ReleaseTensorTypeAndShapeInfo;
public IntPtr ReleaseSessionOptions;
public IntPtr ReleaseCustomOpDomain;
public IntPtr GetDenotationFromTypeInfo;
public IntPtr CastTypeInfoToMapTypeInfo;
public IntPtr CastTypeInfoToSequenceTypeInfo;
public IntPtr GetMapKeyType;
public IntPtr GetMapValueType;
public IntPtr GetSequenceElementType;
public IntPtr ReleaseMapTypeInfo;
public IntPtr ReleaseSequenceTypeInfo;
public IntPtr SessionEndProfiling;
public IntPtr SessionGetModelMetadata;
public IntPtr ModelMetadataGetProducerName;
public IntPtr ModelMetadataGetGraphName;
public IntPtr ModelMetadataGetDomain;
public IntPtr ModelMetadataGetDescription;
public IntPtr ModelMetadataLookupCustomMetadataMap;
public IntPtr ModelMetadataGetVersion;
public IntPtr ReleaseModelMetadata;
public IntPtr CreateEnvWithGlobalThreadPools;
public IntPtr DisablePerSessionThreads;
public IntPtr CreateThreadingOptions;
public IntPtr ReleaseThreadingOptions;
public IntPtr ModelMetadataGetCustomMetadataMapKeys;
public IntPtr AddFreeDimensionOverrideByName;
public IntPtr GetAvailableProviders;
public IntPtr ReleaseAvailableProviders;
public IntPtr GetStringTensorElementLength;
public IntPtr GetStringTensorElement;
public IntPtr FillStringTensorElement;
public IntPtr AddSessionConfigEntry;
public IntPtr CreateAllocator;
public IntPtr ReleaseAllocator;
public IntPtr RunWithBinding;
public IntPtr CreateIoBinding;
public IntPtr ReleaseIoBinding;
public IntPtr BindInput;
public IntPtr BindOutput;
public IntPtr BindOutputToDevice;
public IntPtr GetBoundOutputNames;
public IntPtr GetBoundOutputValues;
public IntPtr ClearBoundInputs;
public IntPtr ClearBoundOutputs;
public IntPtr TensorAt;
public IntPtr CreateAndRegisterAllocator;
public IntPtr SetLanguageProjection;
public IntPtr SessionGetProfilingStartTimeNs;
public IntPtr SetGlobalIntraOpNumThreads;
public IntPtr SetGlobalInterOpNumThreads;
public IntPtr SetGlobalSpinControl;
public IntPtr AddInitializer;
public IntPtr CreateEnvWithCustomLoggerAndGlobalThreadPools;
public IntPtr SessionOptionsAppendExecutionProvider_CUDA;
public IntPtr SessionOptionsAppendExecutionProvider_ROCM;
public IntPtr SessionOptionsAppendExecutionProvider_OpenVINO;
public IntPtr SetGlobalDenormalAsZero;
public IntPtr CreateArenaCfg;
public IntPtr ReleaseArenaCfg;
public IntPtr ModelMetadataGetGraphDescription;
public IntPtr SessionOptionsAppendExecutionProvider_TensorRT;
public IntPtr SetCurrentGpuDeviceId;
public IntPtr GetCurrentGpuDeviceId;
public IntPtr KernelInfoGetAttributeArray_float;
public IntPtr KernelInfoGetAttributeArray_int64;
public IntPtr CreateArenaCfgV2;
public IntPtr AddRunConfigEntry;
public IntPtr CreatePrepackedWeightsContainer;
public IntPtr ReleasePrepackedWeightsContainer;
public IntPtr CreateSessionWithPrepackedWeightsContainer;
public IntPtr CreateSessionFromArrayWithPrepackedWeightsContainer;
public IntPtr SessionOptionsAppendExecutionProvider_TensorRT_V2;
public IntPtr CreateTensorRTProviderOptions;
public IntPtr UpdateTensorRTProviderOptions;
public IntPtr GetTensorRTProviderOptionsAsString;
public IntPtr ReleaseTensorRTProviderOptions;
public IntPtr EnableOrtCustomOps;
public IntPtr RegisterAllocator;
public IntPtr UnregisterAllocator;
public IntPtr IsSparseTensor;
public IntPtr CreateSparseTensorAsOrtValue;
public IntPtr FillSparseTensorCoo;
public IntPtr FillSparseTensorCsr;
public IntPtr FillSparseTensorBlockSparse;
public IntPtr CreateSparseTensorWithValuesAsOrtValue;
public IntPtr UseCooIndices;
public IntPtr UseCsrIndices;
public IntPtr UseBlockSparseIndices;
public IntPtr GetSparseTensorFormat;
public IntPtr GetSparseTensorValuesTypeAndShape;
public IntPtr GetSparseTensorValues;
public IntPtr GetSparseTensorIndicesTypeShape;
public IntPtr GetSparseTensorIndices;
public IntPtr HasValue;
public IntPtr KernelContext_GetGPUComputeStream;
public IntPtr GetTensorMemoryInfo;
public IntPtr GetExecutionProviderApi;
public IntPtr SessionOptionsSetCustomCreateThreadFn;
public IntPtr SessionOptionsSetCustomThreadCreationOptions;
public IntPtr SessionOptionsSetCustomJoinThreadFn;
public IntPtr SetGlobalCustomCreateThreadFn;
public IntPtr SetGlobalCustomThreadCreationOptions;
public IntPtr SetGlobalCustomJoinThreadFn;
public IntPtr SynchronizeBoundInputs;
public IntPtr SynchronizeBoundOutputs;
public IntPtr SessionOptionsAppendExecutionProvider_CUDA_V2;
public IntPtr CreateCUDAProviderOptions;
public IntPtr UpdateCUDAProviderOptions;
public IntPtr GetCUDAProviderOptionsAsString;
public IntPtr ReleaseCUDAProviderOptions;
public IntPtr SessionOptionsAppendExecutionProvider_MIGraphX;
public IntPtr AddExternalInitializers;
public IntPtr CreateOpAttr;
public IntPtr ReleaseOpAttr;
public IntPtr CreateOp;
public IntPtr InvokeOp;
public IntPtr ReleaseOp;
public IntPtr SessionOptionsAppendExecutionProvider;
public IntPtr CopyKernelInfo;
public IntPtr ReleaseKernelInfo;
public IntPtr GetTrainingApi;
public IntPtr SessionOptionsAppendExecutionProvider_CANN;
public IntPtr CreateCANNProviderOptions;
public IntPtr UpdateCANNProviderOptions;
public IntPtr GetCANNProviderOptionsAsString;
public IntPtr ReleaseCANNProviderOptions;
public IntPtr MemoryInfoGetDeviceType;
public IntPtr UpdateEnvWithCustomLogLevel;
public IntPtr SetGlobalIntraOpThreadAffinity;
public IntPtr RegisterCustomOpsLibrary_V2;
public IntPtr RegisterCustomOpsUsingFunction;
public IntPtr KernelInfo_GetInputCount;
public IntPtr KernelInfo_GetOutputCount;
public IntPtr KernelInfo_GetInputName;
public IntPtr KernelInfo_GetOutputName;
public IntPtr KernelInfo_GetInputTypeInfo;
public IntPtr KernelInfo_GetOutputTypeInfo;
public IntPtr KernelInfoGetAttribute_tensor;
public IntPtr HasSessionConfigEntry;
public IntPtr GetSessionConfigEntry;
public IntPtr SessionOptionsAppendExecutionProvider_Dnnl;
public IntPtr CreateDnnlProviderOptions;
public IntPtr UpdateDnnlProviderOptions;
public IntPtr GetDnnlProviderOptionsAsString;
public IntPtr ReleaseDnnlProviderOptions;
public IntPtr KernelInfo_GetNodeName;
public IntPtr KernelInfo_GetLogger;
public IntPtr KernelContext_GetLogger;
public IntPtr Logger_LogMessage;
public IntPtr Logger_GetLoggingSeverityLevel;
public IntPtr KernelInfoGetConstantInput_tensor;
public IntPtr CastTypeInfoToOptionalTypeInfo;
public IntPtr GetOptionalContainedTypeInfo;
public IntPtr GetResizedStringTensorElementBuffer;
public IntPtr KernelContext_GetAllocator;
public IntPtr GetBuildInfoString;
public IntPtr CreateROCMProviderOptions;
public IntPtr UpdateROCMProviderOptions;
public IntPtr GetROCMProviderOptionsAsString;
public IntPtr ReleaseROCMProviderOptions;
public IntPtr CreateAndRegisterAllocatorV2;
public IntPtr RunAsync;
}
internal static class NativeMethods
{
static OrtApi api_;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate ref OrtApi DOrtGetApi(UInt32 version);
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr DOrtGetVersionString();
public static DOrtGetVersionString OrtGetVersionString;
static NativeMethods()
{
DOrtGetApi OrtGetApi = (DOrtGetApi)Marshal.GetDelegateForFunctionPointer(OrtGetApiBase().GetApi, typeof(DOrtGetApi));
// TODO: Make this save the pointer, and not copy the whole structure across
api_ = (OrtApi)OrtGetApi(14 /*ORT_API_VERSION*/);
OrtGetVersionString = (DOrtGetVersionString)Marshal.GetDelegateForFunctionPointer(OrtGetApiBase().GetVersionString, typeof(DOrtGetVersionString));
OrtCreateEnv = (DOrtCreateEnv)Marshal.GetDelegateForFunctionPointer(api_.CreateEnv, typeof(DOrtCreateEnv));
OrtCreateEnvWithCustomLogger = (DOrtCreateEnvWithCustomLogger)Marshal.GetDelegateForFunctionPointer(api_.CreateEnvWithCustomLogger, typeof(DOrtCreateEnvWithCustomLogger));
OrtCreateEnvWithGlobalThreadPools = (DOrtCreateEnvWithGlobalThreadPools)Marshal.GetDelegateForFunctionPointer(api_.CreateEnvWithGlobalThreadPools, typeof(DOrtCreateEnvWithGlobalThreadPools));
OrtCreateEnvWithCustomLoggerAndGlobalThreadPools = (DOrtCreateEnvWithCustomLoggerAndGlobalThreadPools)Marshal.GetDelegateForFunctionPointer(api_.CreateEnvWithCustomLoggerAndGlobalThreadPools, typeof(DOrtCreateEnvWithCustomLoggerAndGlobalThreadPools));
OrtReleaseEnv = (DOrtReleaseEnv)Marshal.GetDelegateForFunctionPointer(api_.ReleaseEnv, typeof(DOrtReleaseEnv));
OrtEnableTelemetryEvents = (DOrtEnableTelemetryEvents)Marshal.GetDelegateForFunctionPointer(api_.EnableTelemetryEvents, typeof(DOrtEnableTelemetryEvents));
OrtDisableTelemetryEvents = (DOrtDisableTelemetryEvents)Marshal.GetDelegateForFunctionPointer(api_.DisableTelemetryEvents, typeof(DOrtDisableTelemetryEvents));
OrtGetErrorCode = (DOrtGetErrorCode)Marshal.GetDelegateForFunctionPointer(api_.GetErrorCode, typeof(DOrtGetErrorCode));
OrtGetErrorMessage = (DOrtGetErrorMessage)Marshal.GetDelegateForFunctionPointer(api_.GetErrorMessage, typeof(DOrtGetErrorMessage));
OrtReleaseStatus = (DOrtReleaseStatus)Marshal.GetDelegateForFunctionPointer(api_.ReleaseStatus, typeof(DOrtReleaseStatus));
OrtCreateSession = (DOrtCreateSession)Marshal.GetDelegateForFunctionPointer(api_.CreateSession, typeof(DOrtCreateSession));
OrtCreateSessionWithPrepackedWeightsContainer =
(DOrtCreateSessionWithPrepackedWeightsContainer)Marshal.GetDelegateForFunctionPointer(api_.CreateSessionWithPrepackedWeightsContainer, typeof(DOrtCreateSessionWithPrepackedWeightsContainer));
OrtCreateSessionFromArray = (DOrtCreateSessionFromArray)Marshal.GetDelegateForFunctionPointer(api_.CreateSessionFromArray, typeof(DOrtCreateSessionFromArray));
OrtCreateSessionFromArrayWithPrepackedWeightsContainer =
(DOrtCreateSessionFromArrayWithPrepackedWeightsContainer)Marshal.GetDelegateForFunctionPointer(api_.CreateSessionFromArrayWithPrepackedWeightsContainer, typeof(DOrtCreateSessionFromArrayWithPrepackedWeightsContainer));
OrtRun = (DOrtRun)Marshal.GetDelegateForFunctionPointer(api_.Run, typeof(DOrtRun));
OrtRunWithBinding = (DOrtRunWithBinding)Marshal.GetDelegateForFunctionPointer(api_.RunWithBinding, typeof(DOrtRunWithBinding));
OrtSessionGetInputCount = (DOrtSessionGetInputCount)Marshal.GetDelegateForFunctionPointer(api_.SessionGetInputCount, typeof(DOrtSessionGetInputCount));
OrtSessionGetOutputCount = (DOrtSessionGetOutputCount)Marshal.GetDelegateForFunctionPointer(api_.SessionGetOutputCount, typeof(DOrtSessionGetOutputCount));
OrtSessionGetOverridableInitializerCount = (DOrtSessionGetOverridableInitializerCount)Marshal.GetDelegateForFunctionPointer(api_.SessionGetOverridableInitializerCount, typeof(DOrtSessionGetOverridableInitializerCount));
OrtSessionGetInputName = (DOrtSessionGetInputName)Marshal.GetDelegateForFunctionPointer(api_.SessionGetInputName, typeof(DOrtSessionGetInputName));
OrtSessionGetOutputName = (DOrtSessionGetOutputName)Marshal.GetDelegateForFunctionPointer(api_.SessionGetOutputName, typeof(DOrtSessionGetOutputName));
OrtSessionEndProfiling = (DOrtSessionEndProfiling)Marshal.GetDelegateForFunctionPointer(api_.SessionEndProfiling, typeof(DOrtSessionEndProfiling));
OrtSessionGetOverridableInitializerName = (DOrtSessionGetOverridableInitializerName)Marshal.GetDelegateForFunctionPointer(api_.SessionGetOverridableInitializerName, typeof(DOrtSessionGetOverridableInitializerName));
OrtSessionGetInputTypeInfo = (DOrtSessionGetInputTypeInfo)Marshal.GetDelegateForFunctionPointer(api_.SessionGetInputTypeInfo, typeof(DOrtSessionGetInputTypeInfo));
OrtSessionGetOutputTypeInfo = (DOrtSessionGetOutputTypeInfo)Marshal.GetDelegateForFunctionPointer(api_.SessionGetOutputTypeInfo, typeof(DOrtSessionGetOutputTypeInfo));
OrtSessionGetOverridableInitializerTypeInfo = (DOrtSessionGetOverridableInitializerTypeInfo)Marshal.GetDelegateForFunctionPointer(api_.SessionGetOverridableInitializerTypeInfo, typeof(DOrtSessionGetOverridableInitializerTypeInfo));
OrtReleaseTypeInfo = (DOrtReleaseTypeInfo)Marshal.GetDelegateForFunctionPointer(api_.ReleaseTypeInfo, typeof(DOrtReleaseTypeInfo));
OrtReleaseSession = (DOrtReleaseSession)Marshal.GetDelegateForFunctionPointer(api_.ReleaseSession, typeof(DOrtReleaseSession));
OrtSessionGetProfilingStartTimeNs = (DOrtSessionGetProfilingStartTimeNs)Marshal.GetDelegateForFunctionPointer(api_.SessionGetProfilingStartTimeNs, typeof(DOrtSessionGetProfilingStartTimeNs));
OrtCreateSessionOptions = (DOrtCreateSessionOptions)Marshal.GetDelegateForFunctionPointer(api_.CreateSessionOptions, typeof(DOrtCreateSessionOptions));
OrtReleaseSessionOptions = (DOrtReleaseSessionOptions)Marshal.GetDelegateForFunctionPointer(api_.ReleaseSessionOptions, typeof(DOrtReleaseSessionOptions));
OrtCloneSessionOptions = (DOrtCloneSessionOptions)Marshal.GetDelegateForFunctionPointer(api_.CloneSessionOptions, typeof(DOrtCloneSessionOptions));
OrtSetSessionExecutionMode = (DOrtSetSessionExecutionMode)Marshal.GetDelegateForFunctionPointer(api_.SetSessionExecutionMode, typeof(DOrtSetSessionExecutionMode));
OrtSetOptimizedModelFilePath = (DOrtSetOptimizedModelFilePath)Marshal.GetDelegateForFunctionPointer(api_.SetOptimizedModelFilePath, typeof(DOrtSetOptimizedModelFilePath));
OrtEnableProfiling = (DOrtEnableProfiling)Marshal.GetDelegateForFunctionPointer(api_.EnableProfiling, typeof(DOrtEnableProfiling));
OrtDisableProfiling = (DOrtDisableProfiling)Marshal.GetDelegateForFunctionPointer(api_.DisableProfiling, typeof(DOrtDisableProfiling));
OrtEnableMemPattern = (DOrtEnableMemPattern)Marshal.GetDelegateForFunctionPointer(api_.EnableMemPattern, typeof(DOrtEnableMemPattern));
OrtDisableMemPattern = (DOrtDisableMemPattern)Marshal.GetDelegateForFunctionPointer(api_.DisableMemPattern, typeof(DOrtDisableMemPattern));
OrtEnableCpuMemArena = (DOrtEnableCpuMemArena)Marshal.GetDelegateForFunctionPointer(api_.EnableCpuMemArena, typeof(DOrtEnableCpuMemArena));
OrtDisableCpuMemArena = (DOrtDisableCpuMemArena)Marshal.GetDelegateForFunctionPointer(api_.DisableCpuMemArena, typeof(DOrtDisableCpuMemArena));
OrtSetSessionLogId = (DOrtSetSessionLogId)Marshal.GetDelegateForFunctionPointer(api_.SetSessionLogId, typeof(DOrtSetSessionLogId));
OrtSetSessionLogVerbosityLevel = (DOrtSetSessionLogVerbosityLevel)Marshal.GetDelegateForFunctionPointer(api_.SetSessionLogVerbosityLevel, typeof(DOrtSetSessionLogVerbosityLevel));
OrtSetSessionLogSeverityLevel = (DOrtSetSessionLogSeverityLevel)Marshal.GetDelegateForFunctionPointer(api_.SetSessionLogSeverityLevel, typeof(DOrtSetSessionLogSeverityLevel));
OrtSetInterOpNumThreads = (DOrtSetInterOpNumThreads)Marshal.GetDelegateForFunctionPointer(api_.SetInterOpNumThreads, typeof(DOrtSetInterOpNumThreads));
OrtSetIntraOpNumThreads = (DOrtSetIntraOpNumThreads)Marshal.GetDelegateForFunctionPointer(api_.SetIntraOpNumThreads, typeof(DOrtSetIntraOpNumThreads));
OrtSetSessionGraphOptimizationLevel = (DOrtSetSessionGraphOptimizationLevel)Marshal.GetDelegateForFunctionPointer(api_.SetSessionGraphOptimizationLevel, typeof(DOrtSetSessionGraphOptimizationLevel));
OrtRegisterCustomOpsLibrary = (DOrtRegisterCustomOpsLibrary)Marshal.GetDelegateForFunctionPointer(api_.RegisterCustomOpsLibrary, typeof(DOrtRegisterCustomOpsLibrary));
OrtRegisterCustomOpsLibrary_V2 = (DOrtRegisterCustomOpsLibrary_V2)Marshal.GetDelegateForFunctionPointer(api_.RegisterCustomOpsLibrary_V2, typeof(DOrtRegisterCustomOpsLibrary_V2));
OrtAddSessionConfigEntry = (DOrtAddSessionConfigEntry)Marshal.GetDelegateForFunctionPointer(api_.AddSessionConfigEntry, typeof(DOrtAddSessionConfigEntry));
OrtAddInitializer = (DOrtAddInitializer)Marshal.GetDelegateForFunctionPointer(api_.AddInitializer, typeof(DOrtAddInitializer));
SessionOptionsAppendExecutionProvider_TensorRT = (DSessionOptionsAppendExecutionProvider_TensorRT)Marshal.GetDelegateForFunctionPointer(
api_.SessionOptionsAppendExecutionProvider_TensorRT, typeof(DSessionOptionsAppendExecutionProvider_TensorRT));
OrtCreateRunOptions = (DOrtCreateRunOptions)Marshal.GetDelegateForFunctionPointer(api_.CreateRunOptions, typeof(DOrtCreateRunOptions));
OrtReleaseRunOptions = (DOrtReleaseRunOptions)Marshal.GetDelegateForFunctionPointer(api_.ReleaseRunOptions, typeof(DOrtReleaseRunOptions));
OrtRunOptionsSetRunLogVerbosityLevel = (DOrtRunOptionsSetRunLogVerbosityLevel)Marshal.GetDelegateForFunctionPointer(api_.RunOptionsSetRunLogVerbosityLevel, typeof(DOrtRunOptionsSetRunLogVerbosityLevel));
OrtRunOptionsSetRunLogSeverityLevel = (DOrtRunOptionsSetRunLogSeverityLevel)Marshal.GetDelegateForFunctionPointer(api_.RunOptionsSetRunLogSeverityLevel, typeof(DOrtRunOptionsSetRunLogSeverityLevel));
OrtRunOptionsSetRunTag = (DOrtRunOptionsSetRunTag)Marshal.GetDelegateForFunctionPointer(api_.RunOptionsSetRunTag, typeof(DOrtRunOptionsSetRunTag));
OrtRunOptionsGetRunLogVerbosityLevel = (DOrtRunOptionsGetRunLogVerbosityLevel)Marshal.GetDelegateForFunctionPointer(api_.RunOptionsGetRunLogVerbosityLevel, typeof(DOrtRunOptionsGetRunLogVerbosityLevel));
OrtRunOptionsGetRunLogSeverityLevel = (DOrtRunOptionsGetRunLogSeverityLevel)Marshal.GetDelegateForFunctionPointer(api_.RunOptionsGetRunLogSeverityLevel, typeof(DOrtRunOptionsGetRunLogSeverityLevel));
OrtRunOptionsGetRunTag = (DOrtRunOptionsGetRunTag)Marshal.GetDelegateForFunctionPointer(api_.RunOptionsGetRunTag, typeof(DOrtRunOptionsGetRunTag));
OrtRunOptionsSetTerminate = (DOrtRunOptionsSetTerminate)Marshal.GetDelegateForFunctionPointer(api_.RunOptionsSetTerminate, typeof(DOrtRunOptionsSetTerminate));
OrtRunOptionsUnsetTerminate = (DOrtRunOptionsUnsetTerminate)Marshal.GetDelegateForFunctionPointer(api_.RunOptionsUnsetTerminate, typeof(DOrtRunOptionsUnsetTerminate));
OrtCreateThreadingOptions = (DOrtCreateThreadingOptions)Marshal.GetDelegateForFunctionPointer(api_.CreateThreadingOptions, typeof(DOrtCreateThreadingOptions));
OrtReleaseThreadingOptions = (DOrtReleaseThreadingOptions)Marshal.GetDelegateForFunctionPointer(api_.ReleaseThreadingOptions, typeof(DOrtReleaseThreadingOptions));
OrtThreadingOptionsSetGlobalInterOpNumThreads = (DOrtThreadingOptionsSetGlobalInterOpNumThreads)Marshal.GetDelegateForFunctionPointer(api_.SetGlobalInterOpNumThreads, typeof(DOrtThreadingOptionsSetGlobalInterOpNumThreads));
OrtThreadingOptionsSetGlobalIntraOpNumThreads = (DOrtThreadingOptionsSetGlobalIntraOpNumThreads)Marshal.GetDelegateForFunctionPointer(api_.SetGlobalIntraOpNumThreads, typeof(DOrtThreadingOptionsSetGlobalIntraOpNumThreads));
OrtThreadingOptionsSetGlobalDenormalAsZero = (DOrtThreadingOptionsSetGlobalDenormalAsZero)Marshal.GetDelegateForFunctionPointer(api_.SetGlobalDenormalAsZero, typeof(DOrtThreadingOptionsSetGlobalDenormalAsZero));
OrtThreadingOptionsSetGlobalSpinControl = (DOrtThreadingOptionsSetGlobalSpinControl)Marshal.GetDelegateForFunctionPointer(api_.SetGlobalSpinControl, typeof(DOrtThreadingOptionsSetGlobalSpinControl));
OrtAddRunConfigEntry = (DOrtAddRunConfigEntry)Marshal.GetDelegateForFunctionPointer(api_.AddRunConfigEntry, typeof(DOrtAddRunConfigEntry));
OrtCreateArenaCfg = (DOrtCreateArenaCfg)Marshal.GetDelegateForFunctionPointer(api_.CreateArenaCfg, typeof(DOrtCreateArenaCfg));
OrtReleaseArenaCfg = (DOrtReleaseArenaCfg)Marshal.GetDelegateForFunctionPointer(api_.ReleaseArenaCfg, typeof(DOrtReleaseArenaCfg));
OrtReleaseAllocator = (DOrtReleaseAllocator)Marshal.GetDelegateForFunctionPointer(api_.ReleaseAllocator, typeof(DOrtReleaseAllocator));
OrtCreateMemoryInfo = (DOrtCreateMemoryInfo)Marshal.GetDelegateForFunctionPointer(api_.CreateMemoryInfo, typeof(DOrtCreateMemoryInfo));
OrtCreateCpuMemoryInfo = (DOrtCreateCpuMemoryInfo)Marshal.GetDelegateForFunctionPointer(api_.CreateCpuMemoryInfo, typeof(DOrtCreateCpuMemoryInfo));
OrtReleaseMemoryInfo = (DOrtReleaseMemoryInfo)Marshal.GetDelegateForFunctionPointer(api_.ReleaseMemoryInfo, typeof(DOrtReleaseMemoryInfo));
OrtCompareMemoryInfo = (DOrtCompareMemoryInfo)Marshal.GetDelegateForFunctionPointer(api_.CompareMemoryInfo, typeof(DOrtCompareMemoryInfo));
OrtMemoryInfoGetName = (DOrtMemoryInfoGetName)Marshal.GetDelegateForFunctionPointer(api_.MemoryInfoGetName, typeof(DOrtMemoryInfoGetName));
OrtMemoryInfoGetId = (DOrtMemoryInfoGetId)Marshal.GetDelegateForFunctionPointer(api_.MemoryInfoGetId, typeof(DOrtMemoryInfoGetId));
OrtMemoryInfoGetMemType = (DOrtMemoryInfoGetMemType)Marshal.GetDelegateForFunctionPointer(api_.MemoryInfoGetMemType, typeof(DOrtMemoryInfoGetMemType));
OrtMemoryInfoGetType = (DOrtMemoryInfoGetType)Marshal.GetDelegateForFunctionPointer(api_.MemoryInfoGetType, typeof(DOrtMemoryInfoGetType));
OrtGetAllocatorWithDefaultOptions = (DOrtGetAllocatorWithDefaultOptions)Marshal.GetDelegateForFunctionPointer(api_.GetAllocatorWithDefaultOptions, typeof(DOrtGetAllocatorWithDefaultOptions));
OrtCreateAllocator = (DOrtCreateAllocator)Marshal.GetDelegateForFunctionPointer(api_.CreateAllocator, typeof(DOrtCreateAllocator));
OrtReleaseAllocator = (DOrtReleaseAllocator)Marshal.GetDelegateForFunctionPointer(api_.ReleaseAllocator, typeof(DOrtReleaseAllocator));
OrtAllocatorAlloc = (DOrtAllocatorAlloc)Marshal.GetDelegateForFunctionPointer(api_.AllocatorAlloc, typeof(DOrtAllocatorAlloc));
OrtAllocatorFree = (DOrtAllocatorFree)Marshal.GetDelegateForFunctionPointer(api_.AllocatorFree, typeof(DOrtAllocatorFree));
OrtAllocatorGetInfo = (DOrtAllocatorGetInfo)Marshal.GetDelegateForFunctionPointer(api_.AllocatorGetInfo, typeof(DOrtAllocatorGetInfo));
OrtAddFreeDimensionOverride = (DOrtAddFreeDimensionOverride)Marshal.GetDelegateForFunctionPointer(api_.AddFreeDimensionOverride, typeof(DOrtAddFreeDimensionOverride));
OrtAddFreeDimensionOverrideByName = (DOrtAddFreeDimensionOverrideByName)Marshal.GetDelegateForFunctionPointer(api_.AddFreeDimensionOverrideByName, typeof(DOrtAddFreeDimensionOverrideByName));
OrtCreateIoBinding = (DOrtCreateIoBinding)Marshal.GetDelegateForFunctionPointer(api_.CreateIoBinding, typeof(DOrtCreateIoBinding));
OrtReleaseIoBinding = (DOrtReleaseIoBinding)Marshal.GetDelegateForFunctionPointer(api_.ReleaseIoBinding, typeof(DOrtReleaseIoBinding));
OrtBindInput = (DOrtBindInput)Marshal.GetDelegateForFunctionPointer(api_.BindInput, typeof(DOrtBindInput));
OrtSynchronizeBoundInputs = (DOrtSynchronizeBoundInputs)Marshal.GetDelegateForFunctionPointer(api_.SynchronizeBoundInputs, typeof(DOrtSynchronizeBoundInputs));
OrtBindOutput = (DOrtBindOutput)Marshal.GetDelegateForFunctionPointer(api_.BindOutput, typeof(DOrtBindOutput));
OrtBindOutputToDevice = (DOrtBindOutputToDevice)Marshal.GetDelegateForFunctionPointer(api_.BindOutputToDevice, typeof(DOrtBindOutputToDevice));
OrtSynchronizeBoundOutputs = (DOrtSynchronizeBoundOutputs)Marshal.GetDelegateForFunctionPointer(api_.SynchronizeBoundOutputs, typeof(DOrtSynchronizeBoundOutputs));
OrtGetBoundOutputNames = (DOrtGetBoundOutputNames)Marshal.GetDelegateForFunctionPointer(api_.GetBoundOutputNames, typeof(DOrtGetBoundOutputNames));
OrtGetBoundOutputValues = (DOrtGetBoundOutputValues)Marshal.GetDelegateForFunctionPointer(api_.GetBoundOutputValues, typeof(DOrtGetBoundOutputValues));
OrtClearBoundInputs = (DOrtClearBoundInputs)Marshal.GetDelegateForFunctionPointer(api_.ClearBoundInputs, typeof(DOrtClearBoundInputs));
OrtClearBoundOutputs = (DOrtClearBoundOutputs)Marshal.GetDelegateForFunctionPointer(api_.ClearBoundOutputs, typeof(DOrtClearBoundOutputs));
OrtTensorAt = (DOrtTensorAt)Marshal.GetDelegateForFunctionPointer(api_.TensorAt, typeof(DOrtTensorAt));
OrtCreateAndRegisterAllocator = (DOrtCreateAndRegisterAllocator)Marshal.GetDelegateForFunctionPointer(api_.CreateAndRegisterAllocator, typeof(DOrtCreateAndRegisterAllocator));
OrtSetLanguageProjection = (DOrtSetLanguageProjection)Marshal.GetDelegateForFunctionPointer(api_.SetLanguageProjection, typeof(DOrtSetLanguageProjection));
OrtHasValue = (DOrtHasValue)Marshal.GetDelegateForFunctionPointer(api_.HasValue, typeof(DOrtHasValue));
OrtGetValue = (DOrtGetValue)Marshal.GetDelegateForFunctionPointer(api_.GetValue, typeof(DOrtGetValue));
OrtGetValueCount = (DOrtGetValueCount)Marshal.GetDelegateForFunctionPointer(api_.GetValueCount, typeof(DOrtGetValueCount));
OrtCreateValue = (DOrtCreateValue)Marshal.GetDelegateForFunctionPointer(api_.CreateValue, typeof(DOrtCreateValue));
OrtGetValueType = (DOrtGetValueType)Marshal.GetDelegateForFunctionPointer(api_.GetValueType, typeof(DOrtGetValueType));
OrtGetOnnxTypeFromTypeInfo = (DOrtGetOnnxTypeFromTypeInfo)Marshal.GetDelegateForFunctionPointer(api_.GetOnnxTypeFromTypeInfo, typeof(DOrtGetOnnxTypeFromTypeInfo));
OrtGetTypeInfo = (DOrtGetTypeInfo)Marshal.GetDelegateForFunctionPointer(api_.GetTypeInfo, typeof(DOrtGetTypeInfo));
OrtCreateTensorAsOrtValue = (DOrtCreateTensorAsOrtValue)Marshal.GetDelegateForFunctionPointer(api_.CreateTensorAsOrtValue, typeof(DOrtCreateTensorAsOrtValue));
OrtCreateTensorWithDataAsOrtValue = (DOrtCreateTensorWithDataAsOrtValue)Marshal.GetDelegateForFunctionPointer(api_.CreateTensorWithDataAsOrtValue, typeof(DOrtCreateTensorWithDataAsOrtValue));
OrtValueIsTensor = (DOrtValueIsTensor)Marshal.GetDelegateForFunctionPointer(api_.IsTensor, typeof(DOrtValueIsTensor));
OrtValueIsSparseTensor = (DOrtValueIsSparseTensor)Marshal.GetDelegateForFunctionPointer(api_.IsSparseTensor, typeof(DOrtValueIsSparseTensor));
OrtGetTensorMutableData = (DOrtGetTensorMutableData)Marshal.GetDelegateForFunctionPointer(api_.GetTensorMutableData, typeof(DOrtGetTensorMutableData));
OrtFillStringTensor = (DOrtFillStringTensor)Marshal.GetDelegateForFunctionPointer(api_.FillStringTensor, typeof(DOrtFillStringTensor));
OrtGetResizedStringTensorElementBuffer = (DOrtGetResizedStringTensorElementBuffer)Marshal.GetDelegateForFunctionPointer(api_.GetResizedStringTensorElementBuffer, typeof(DOrtGetResizedStringTensorElementBuffer));
OrtGetStringTensorContent = (DOrtGetStringTensorContent)Marshal.GetDelegateForFunctionPointer(api_.GetStringTensorContent, typeof(DOrtGetStringTensorContent));
OrtGetStringTensorDataLength = (DOrtGetStringTensorDataLength)Marshal.GetDelegateForFunctionPointer(api_.GetStringTensorDataLength, typeof(DOrtGetStringTensorDataLength));
OrtGetStringTensorElementLength = (DOrtGetStringTensorElementLength)Marshal.GetDelegateForFunctionPointer(api_.GetStringTensorElementLength, typeof(DOrtGetStringTensorElementLength));
OrtGetStringTensorElement = (DOrtGetStringTensorElement)Marshal.GetDelegateForFunctionPointer(api_.GetStringTensorElement, typeof(DOrtGetStringTensorElement));
OrtCastTypeInfoToTensorInfo = (DOrtCastTypeInfoToTensorInfo)Marshal.GetDelegateForFunctionPointer(api_.CastTypeInfoToTensorInfo, typeof(DOrtCastTypeInfoToTensorInfo));
OrtGetTensorTypeAndShape = (DOrtGetTensorTypeAndShape)Marshal.GetDelegateForFunctionPointer(api_.GetTensorTypeAndShape, typeof(DOrtGetTensorTypeAndShape));
OrtReleaseTensorTypeAndShapeInfo = (DOrtReleaseTensorTypeAndShapeInfo)Marshal.GetDelegateForFunctionPointer(api_.ReleaseTensorTypeAndShapeInfo, typeof(DOrtReleaseTensorTypeAndShapeInfo));
OrtGetTensorElementType = (DOrtGetTensorElementType)Marshal.GetDelegateForFunctionPointer(api_.GetTensorElementType, typeof(DOrtGetTensorElementType));
OrtGetDimensionsCount = (DOrtGetDimensionsCount)Marshal.GetDelegateForFunctionPointer(api_.GetDimensionsCount, typeof(DOrtGetDimensionsCount));
OrtGetDimensions = (DOrtGetDimensions)Marshal.GetDelegateForFunctionPointer(api_.GetDimensions, typeof(DOrtGetDimensions));
OrtGetSymbolicDimensions = (DOrtGetSymbolicDimensions)Marshal.GetDelegateForFunctionPointer(api_.GetSymbolicDimensions, typeof(DOrtGetSymbolicDimensions));
OrtGetTensorShapeElementCount = (DOrtGetTensorShapeElementCount)Marshal.GetDelegateForFunctionPointer(api_.GetTensorShapeElementCount, typeof(DOrtGetTensorShapeElementCount));
OrtGetTensorMemoryInfo = (DOrtGetTensorMemoryInfo)Marshal.GetDelegateForFunctionPointer(api_.GetTensorMemoryInfo, typeof(DOrtGetTensorMemoryInfo));
// MapTypeInfo
OrtGetMapKeyType = (DGetMapKeyType)Marshal.GetDelegateForFunctionPointer(api_.GetMapKeyType, typeof(DGetMapKeyType));
OrtCastTypeInfoToMapTypeInfo = (DCastTypeInfoToMapTypeInfo)Marshal.GetDelegateForFunctionPointer(api_.CastTypeInfoToMapTypeInfo, typeof(DCastTypeInfoToMapTypeInfo));
OrtGetMapValueType = (DGetMapValueType)Marshal.GetDelegateForFunctionPointer(api_.GetMapValueType, typeof(DGetMapValueType));
// SequenceTypeInfo
OrtCastTypeInfoToSequenceTypeInfo = (DCastTypeInfoToSequenceTypeInfo)Marshal.GetDelegateForFunctionPointer(api_.CastTypeInfoToSequenceTypeInfo, typeof(DCastTypeInfoToSequenceTypeInfo));
OrtGetSequenceElementType = (DGetSequenceElementType)Marshal.GetDelegateForFunctionPointer(api_.GetSequenceElementType, typeof(DGetSequenceElementType));
// Optional Type info
OrtCastTypeInfoToOptionalTypeInfo = (DOrtCastTypeInfoToOptionalTypeInfo)Marshal.GetDelegateForFunctionPointer(api_.CastTypeInfoToOptionalTypeInfo, typeof(DOrtCastTypeInfoToOptionalTypeInfo));
OrtGetOptionalContainedTypeInfo = (DGetOptionalContainedTypeInfo)Marshal.GetDelegateForFunctionPointer(api_.GetOptionalContainedTypeInfo, typeof(DGetOptionalContainedTypeInfo));
OrtReleaseValue = (DOrtReleaseValue)Marshal.GetDelegateForFunctionPointer(api_.ReleaseValue, typeof(DOrtReleaseValue));
OrtSessionGetModelMetadata = (DOrtSessionGetModelMetadata)Marshal.GetDelegateForFunctionPointer(api_.SessionGetModelMetadata, typeof(DOrtSessionGetModelMetadata));
OrtModelMetadataGetProducerName = (DOrtModelMetadataGetProducerName)Marshal.GetDelegateForFunctionPointer(api_.ModelMetadataGetProducerName, typeof(DOrtModelMetadataGetProducerName));
OrtModelMetadataGetGraphName = (DOrtModelMetadataGetGraphName)Marshal.GetDelegateForFunctionPointer(api_.ModelMetadataGetGraphName, typeof(DOrtModelMetadataGetGraphName));
OrtModelMetadataGetDomain = (DOrtModelMetadataGetDomain)Marshal.GetDelegateForFunctionPointer(api_.ModelMetadataGetDomain, typeof(DOrtModelMetadataGetDomain));
OrtModelMetadataGetDescription = (DOrtModelMetadataGetDescription)Marshal.GetDelegateForFunctionPointer(api_.ModelMetadataGetDescription, typeof(DOrtModelMetadataGetDescription));
OrtModelMetadataGetGraphDescription = (DOrtModelMetadataGetGraphDescription)Marshal.GetDelegateForFunctionPointer(api_.ModelMetadataGetGraphDescription, typeof(DOrtModelMetadataGetGraphDescription));
OrtModelMetadataGetVersion = (DOrtModelMetadataGetVersion)Marshal.GetDelegateForFunctionPointer(api_.ModelMetadataGetVersion, typeof(DOrtModelMetadataGetVersion));
OrtModelMetadataGetCustomMetadataMapKeys = (DOrtModelMetadataGetCustomMetadataMapKeys)Marshal.GetDelegateForFunctionPointer(api_.ModelMetadataGetCustomMetadataMapKeys, typeof(DOrtModelMetadataGetCustomMetadataMapKeys));
OrtModelMetadataLookupCustomMetadataMap = (DOrtModelMetadataLookupCustomMetadataMap)Marshal.GetDelegateForFunctionPointer(api_.ModelMetadataLookupCustomMetadataMap, typeof(DOrtModelMetadataLookupCustomMetadataMap));
OrtReleaseModelMetadata = (DOrtReleaseModelMetadata)Marshal.GetDelegateForFunctionPointer(api_.ReleaseModelMetadata, typeof(DOrtReleaseModelMetadata));
OrtGetAvailableProviders = (DOrtGetAvailableProviders)Marshal.GetDelegateForFunctionPointer(api_.GetAvailableProviders, typeof(DOrtGetAvailableProviders));
OrtReleaseAvailableProviders = (DOrtReleaseAvailableProviders)Marshal.GetDelegateForFunctionPointer(api_.ReleaseAvailableProviders, typeof(DOrtReleaseAvailableProviders));
OrtCreatePrepackedWeightsContainer = (DOrtCreatePrepackedWeightsContainer)Marshal.GetDelegateForFunctionPointer(api_.CreatePrepackedWeightsContainer, typeof(DOrtCreatePrepackedWeightsContainer));
OrtReleasePrepackedWeightsContainer = (DOrtReleasePrepackedWeightsContainer)Marshal.GetDelegateForFunctionPointer(api_.ReleasePrepackedWeightsContainer, typeof(DOrtReleasePrepackedWeightsContainer));
SessionOptionsAppendExecutionProvider_TensorRT_V2 = (DSessionOptionsAppendExecutionProvider_TensorRT_V2)Marshal.GetDelegateForFunctionPointer(
api_.SessionOptionsAppendExecutionProvider_TensorRT_V2, typeof(DSessionOptionsAppendExecutionProvider_TensorRT_V2));
OrtCreateTensorRTProviderOptions = (DOrtCreateTensorRTProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.CreateTensorRTProviderOptions, typeof(DOrtCreateTensorRTProviderOptions));
OrtUpdateTensorRTProviderOptions = (DOrtUpdateTensorRTProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.UpdateTensorRTProviderOptions, typeof(DOrtUpdateTensorRTProviderOptions));
OrtGetTensorRTProviderOptionsAsString = (DOrtGetTensorRTProviderOptionsAsString)Marshal.GetDelegateForFunctionPointer(api_.GetTensorRTProviderOptionsAsString, typeof(DOrtGetTensorRTProviderOptionsAsString));
OrtReleaseTensorRTProviderOptions = (DOrtReleaseTensorRTProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.ReleaseTensorRTProviderOptions, typeof(DOrtReleaseTensorRTProviderOptions));
SessionOptionsAppendExecutionProvider_CUDA = (DSessionOptionsAppendExecutionProvider_CUDA)Marshal.GetDelegateForFunctionPointer(
api_.SessionOptionsAppendExecutionProvider_CUDA, typeof(DSessionOptionsAppendExecutionProvider_CUDA));
SessionOptionsAppendExecutionProvider_CUDA_V2 = (DSessionOptionsAppendExecutionProvider_CUDA_V2)Marshal.GetDelegateForFunctionPointer(
api_.SessionOptionsAppendExecutionProvider_CUDA_V2, typeof(DSessionOptionsAppendExecutionProvider_CUDA_V2));
OrtCreateCUDAProviderOptions = (DOrtCreateCUDAProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.CreateCUDAProviderOptions, typeof(DOrtCreateCUDAProviderOptions));
OrtUpdateCUDAProviderOptions = (DOrtUpdateCUDAProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.UpdateCUDAProviderOptions, typeof(DOrtUpdateCUDAProviderOptions));
OrtGetCUDAProviderOptionsAsString = (DOrtGetCUDAProviderOptionsAsString)Marshal.GetDelegateForFunctionPointer(api_.GetCUDAProviderOptionsAsString, typeof(DOrtGetCUDAProviderOptionsAsString));
OrtReleaseCUDAProviderOptions = (DOrtReleaseCUDAProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.ReleaseCUDAProviderOptions, typeof(DOrtReleaseCUDAProviderOptions));
SessionOptionsAppendExecutionProvider
= (DSessionOptionsAppendExecutionProvider)Marshal.GetDelegateForFunctionPointer(
api_.SessionOptionsAppendExecutionProvider,
typeof(DSessionOptionsAppendExecutionProvider));
OrtUpdateEnvWithCustomLogLevel = (DOrtUpdateEnvWithCustomLogLevel)Marshal.GetDelegateForFunctionPointer(api_.UpdateEnvWithCustomLogLevel, typeof(DOrtUpdateEnvWithCustomLogLevel));
SessionOptionsAppendExecutionProvider_ROCM = (DSessionOptionsAppendExecutionProvider_ROCM)Marshal.GetDelegateForFunctionPointer(
api_.SessionOptionsAppendExecutionProvider_ROCM, typeof(DSessionOptionsAppendExecutionProvider_ROCM));
OrtCreateROCMProviderOptions = (DOrtCreateROCMProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.CreateROCMProviderOptions, typeof(DOrtCreateROCMProviderOptions));
OrtUpdateROCMProviderOptions = (DOrtUpdateROCMProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.UpdateROCMProviderOptions, typeof(DOrtUpdateROCMProviderOptions));
OrtGetROCMProviderOptionsAsString = (DOrtGetROCMProviderOptionsAsString)Marshal.GetDelegateForFunctionPointer(api_.GetROCMProviderOptionsAsString, typeof(DOrtGetROCMProviderOptionsAsString));
OrtReleaseROCMProviderOptions = (DOrtReleaseROCMProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.ReleaseROCMProviderOptions, typeof(DOrtReleaseROCMProviderOptions));
OrtCreateAndRegisterAllocatorV2 = (DCreateAndRegisterAllocatorV2)Marshal.GetDelegateForFunctionPointer(api_.CreateAndRegisterAllocatorV2, typeof(DCreateAndRegisterAllocatorV2));
OrtRunAsync = (DOrtRunAsync)Marshal.GetDelegateForFunctionPointer(api_.RunAsync, typeof(DOrtRunAsync));
}
internal class NativeLib
{
#if __ANDROID__
// define the library name required for android
internal const string DllName = "libonnxruntime.so";
#elif __IOS__
// define the library name required for iOS
internal const string DllName = "__Internal";
#else
internal const string DllName = "onnxruntime";
#endif
}
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi)]
public static extern ref OrtApiBase OrtGetApiBase();
#region Runtime/Environment API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtCreateEnv(
OrtLoggingLevel defaultLoggingLevel,
byte[] /*const char* */ logId,
out IntPtr /*(OrtEnv*)*/ env);
public static DOrtCreateEnv OrtCreateEnv;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtCreateEnvWithCustomLogger(
IntPtr /* (OrtLoggingFunction*) */ loggingFunction,
IntPtr /* (void*) */ loggerParam,
OrtLoggingLevel defaultLoggingLevel,
byte[] /* const char* */ logId,
out IntPtr /*(OrtEnv*)*/ env);
public static DOrtCreateEnvWithCustomLogger OrtCreateEnvWithCustomLogger;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtCreateEnvWithGlobalThreadPools(
OrtLoggingLevel defaultWarningLevel,
byte[] /*const char* */ logId,
IntPtr /*(const OrtThreadingOptions *) */ threadingOptions,
out IntPtr /*(OrtEnv*)*/ env);
public static DOrtCreateEnvWithGlobalThreadPools OrtCreateEnvWithGlobalThreadPools;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */ DOrtCreateEnvWithCustomLoggerAndGlobalThreadPools(
IntPtr /* OrtLoggingFunction */ loggingFunction,
IntPtr /* void* */loggerParam,
OrtLoggingLevel logSeverityLevel,
byte[] /* const char* */ logId,
IntPtr /*(const OrtThreadingOptions *) */ threadingOptions,
out IntPtr /*(OrtEnv*)*/ env);
public static DOrtCreateEnvWithCustomLoggerAndGlobalThreadPools OrtCreateEnvWithCustomLoggerAndGlobalThreadPools;
// OrtReleaseEnv should not be used
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void DOrtReleaseEnv(IntPtr /*(OrtEnv*)*/ env);
public static DOrtReleaseEnv OrtReleaseEnv;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtEnableTelemetryEvents(IntPtr /*(OrtEnv*)*/ env);
public static DOrtEnableTelemetryEvents OrtEnableTelemetryEvents;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtDisableTelemetryEvents(IntPtr /*(OrtEnv*)*/ env);
public static DOrtDisableTelemetryEvents OrtDisableTelemetryEvents;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtUpdateEnvWithCustomLogLevel(IntPtr /*(OrtEnv*)*/ env, OrtLoggingLevel custom_log_level);
public static DOrtUpdateEnvWithCustomLogLevel OrtUpdateEnvWithCustomLogLevel;
#endregion Runtime/Environment API
#region Provider Options API
/// <summary>
/// Creates native OrtTensorRTProviderOptions instance
/// </summary>
/// <param name="trtProviderOptionsInstance">(output) native instance of OrtTensorRTProviderOptions</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtCreateTensorRTProviderOptions(
out IntPtr /*(OrtTensorRTProviderOptions**)*/ trtProviderOptionsInstance);
public static DOrtCreateTensorRTProviderOptions OrtCreateTensorRTProviderOptions;
/// <summary>
/// Updates native OrtTensorRTProviderOptions instance using given key/value pairs
/// </summary>
/// <param name="trtProviderOptionsInstance">native instance of OrtTensorRTProviderOptions</param>
/// <param name="providerOptionsKeys">configuration keys of OrtTensorRTProviderOptions</param>
/// <param name="providerOptionsValues">configuration values of OrtTensorRTProviderOptions</param>
/// <param name="numKeys">number of configuration keys</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtUpdateTensorRTProviderOptions(
IntPtr /*(OrtTensorRTProviderOptions*)*/ trtProviderOptionsInstance,
IntPtr[] /*(const char* const *)*/ providerOptionsKeys,
IntPtr[] /*(const char* const *)*/ providerOptionsValues,
UIntPtr /*(size_t)*/ numKeys);
public static DOrtUpdateTensorRTProviderOptions OrtUpdateTensorRTProviderOptions;
/// <summary>
/// Get native OrtTensorRTProviderOptionsV2 in serialized string
/// </summary>
/// <param name="allocator">instance of OrtAllocator</param>
/// <param name="ptr">is a UTF-8 null terminated string allocated using 'allocator'</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtGetTensorRTProviderOptionsAsString(
IntPtr /*(OrtTensorRTProviderOptionsV2**)*/ trtProviderOptionsInstance,
IntPtr /*(OrtAllocator*)*/ allocator,
out IntPtr /*(char**)*/ptr);
public static DOrtGetTensorRTProviderOptionsAsString OrtGetTensorRTProviderOptionsAsString;
/// <summary>
/// Releases native OrtTensorRTProviderOptions instance
/// </summary>
/// <param name="trtProviderOptionsInstance">native instance of OrtTensorRTProviderOptions to be released</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void DOrtReleaseTensorRTProviderOptions(IntPtr /*(OrtTensorRTProviderOptions*)*/ trtProviderOptionsInstance);
public static DOrtReleaseTensorRTProviderOptions OrtReleaseTensorRTProviderOptions;
/// <summary>
/// Creates native OrtCUDAProviderOptions instance
/// </summary>
/// <param name="cudaProviderOptionsInstance">(output) native instance of OrtCUDAProviderOptions</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtCreateCUDAProviderOptions(
out IntPtr /*(OrtCUDAProviderOptions**)*/ cudaProviderOptionsInstance);
public static DOrtCreateCUDAProviderOptions OrtCreateCUDAProviderOptions;
/// <summary>
/// Updates native OrtCUDAProviderOptions instance using given key/value pairs
/// </summary>
/// <param name="cudaProviderOptionsInstance">native instance of OrtCUDAProviderOptions</param>
/// <param name="providerOptionsKeys">configuration keys of OrtCUDAProviderOptions</param>
/// <param name="providerOptionsValues">configuration values of OrtCUDAProviderOptions</param>
/// <param name="numKeys">number of configuration keys</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtUpdateCUDAProviderOptions(
IntPtr /*(OrtCUDAProviderOptions*)*/ cudaProviderOptionsInstance,
IntPtr[] /*(const char* const *)*/ providerOptionsKeys,
IntPtr[] /*(const char* const *)*/ providerOptionsValues,
UIntPtr /*(size_t)*/ numKeys);
public static DOrtUpdateCUDAProviderOptions OrtUpdateCUDAProviderOptions;
/// <summary>
/// Get native OrtCUDAProviderOptionsV2 in serialized string
/// </summary>
/// <param name="allocator">instance of OrtAllocator</param>
/// <param name="ptr">is a UTF-8 null terminated string allocated using 'allocator'</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtGetCUDAProviderOptionsAsString(
IntPtr /*(OrtCUDAProviderOptionsV2**)*/ cudaProviderOptionsInstance,
IntPtr /*(OrtAllocator*)*/ allocator,
out IntPtr /*(char**)*/ptr);
public static DOrtGetCUDAProviderOptionsAsString OrtGetCUDAProviderOptionsAsString;
/// <summary>
/// Releases native OrtCUDAProviderOptions instance
/// </summary>
/// <param name="cudaProviderOptionsInstance">native instance of OrtCUDAProviderOptions to be released</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void DOrtReleaseCUDAProviderOptions(IntPtr /*(OrtCUDAProviderOptions*)*/ cudaProviderOptionsInstance);
public static DOrtReleaseCUDAProviderOptions OrtReleaseCUDAProviderOptions;
/// <summary>
/// Creates native OrtROCMProviderOptions instance
/// </summary>
/// <param name="rocmProviderOptionsInstance">(output) native instance of OrtROCMProviderOptions</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtCreateROCMProviderOptions(
out IntPtr /*(OrtROCMProviderOptions**)*/ rocmProviderOptionsInstance);
public static DOrtCreateROCMProviderOptions OrtCreateROCMProviderOptions;
/// <summary>
/// Updates native OrtROCMProviderOptions instance using given key/value pairs
/// </summary>
/// <param name="rocmProviderOptionsInstance">native instance of OrtROCMProviderOptions</param>
/// <param name="providerOptionsKeys">configuration keys of OrtROCMProviderOptions</param>
/// <param name="providerOptionsValues">configuration values of OrtROCMProviderOptions</param>
/// <param name="numKeys">number of configuration keys</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtUpdateROCMProviderOptions(
IntPtr /*(OrtROCMProviderOptions*)*/ rocmProviderOptionsInstance,
IntPtr[] /*(const char* const *)*/ providerOptionsKeys,
IntPtr[] /*(const char* const *)*/ providerOptionsValues,
UIntPtr /*(size_t)*/ numKeys);
public static DOrtUpdateROCMProviderOptions OrtUpdateROCMProviderOptions;
/// <summary>
/// Get native OrtROCMProviderOptions in serialized string
/// </summary>
/// <param name="allocator">instance of OrtAllocator</param>
/// <param name="ptr">is a UTF-8 null terminated string allocated using 'allocator'</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtGetROCMProviderOptionsAsString(
IntPtr /*(OrtROCMProviderOptions**)*/ rocmProviderOptionsInstance,
IntPtr /*(OrtAllocator*)*/ allocator,
out IntPtr /*(char**)*/ptr);
public static DOrtGetROCMProviderOptionsAsString OrtGetROCMProviderOptionsAsString;
/// <summary>
/// Releases native OrtROCMProviderOptions instance
/// </summary>
/// <param name="rocmProviderOptionsInstance">native instance of OrtROCMProviderOptions to be released</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void DOrtReleaseROCMProviderOptions(IntPtr /*(OrtROCMProviderOptions*)*/ rocmProviderOptionsInstance);
public static DOrtReleaseROCMProviderOptions OrtReleaseROCMProviderOptions;
#endregion
#region Status API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate ErrorCode DOrtGetErrorCode(IntPtr /*(OrtStatus*)*/status);
public static DOrtGetErrorCode OrtGetErrorCode;
// returns char*, need to convert to string by the caller.
// does not free the underlying OrtStatus*
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* char* */DOrtGetErrorMessage(IntPtr /* (OrtStatus*) */status);
public static DOrtGetErrorMessage OrtGetErrorMessage;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void DOrtReleaseStatus(IntPtr /*(OrtStatus*)*/ statusPtr);
public static DOrtReleaseStatus OrtReleaseStatus;
#endregion Status API
#region InferenceSession API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtCreateSession(
IntPtr /* (OrtEnv*) */ environment,
//[MarshalAs(UnmanagedType.LPStr)]string modelPath
byte[] modelPath,
IntPtr /* (OrtSessionOptions*) */sessopnOptions,
out IntPtr /**/ session);
public static DOrtCreateSession OrtCreateSession;
/// <summary>
/// Creates an instance of OrtSession with provided parameters
/// </summary>
/// <param name="environment">Native OrtEnv instance</param>
/// <param name="modelPath">UTF-8 bytes corresponding to model string path</param>
/// <param name="sessionOptions">Native SessionOptions instance</param>
/// <param name="prepackedWeightsContainer">Native OrtPrepackedWeightsContainer instance</param>
/// <param name="session">(Output) Created native OrtSession instance</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtCreateSessionWithPrepackedWeightsContainer(
IntPtr /* (OrtEnv*) */ environment,
byte[] modelPath,
IntPtr /* (OrtSessionOptions*) */sessionOptions,
IntPtr /* (OrtPrepackedWeightsContainer*) */prepackedWeightsContainer,
out IntPtr /* (OrtSession**) */ session);
public static DOrtCreateSessionWithPrepackedWeightsContainer OrtCreateSessionWithPrepackedWeightsContainer;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtCreateSessionFromArray(
IntPtr /* (OrtEnv*) */ environment,
byte[] modelData,
UIntPtr modelSize,
IntPtr /* (OrtSessionOptions*) */ sessionOptions,
out IntPtr /**/ session);
public static DOrtCreateSessionFromArray OrtCreateSessionFromArray;
/// <summary>
/// Creates an instance of OrtSession with provided parameters
/// </summary>
/// <param name="environment">Native OrtEnv instance</param>
/// <param name="modelData">Byte array correspoonding to the model</param>
/// <param name="modelSize">Size of the model in bytes</param>
/// <param name="sessionOptions">Native SessionOptions instance</param>
/// <param name="prepackedWeightsContainer">Native OrtPrepackedWeightsContainer instance</param>
/// <param name="session">(Output) Created native OrtSession instance</param>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */DOrtCreateSessionFromArrayWithPrepackedWeightsContainer(
IntPtr /* (OrtEnv*) */ environment,
byte[] /* (void*) */ modelData,
UIntPtr /* (size_t) */ modelSize,
IntPtr /* (OrtSessionOptions*) */ sessionOptions,
IntPtr /* (OrtPrepackedWeightsContainer*) */prepackedWeightsContainer,
out IntPtr /* (OrtSession**) */ session);
public static DOrtCreateSessionFromArrayWithPrepackedWeightsContainer OrtCreateSessionFromArrayWithPrepackedWeightsContainer;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(ONNStatus*)*/ DOrtRun(
IntPtr /*(OrtSession*)*/ session,
IntPtr /*(OrtSessionRunOptions*)*/ runOptions, // can be null to use the default options
IntPtr[] inputNames,
IntPtr[] /* (OrtValue*[])*/ inputValues,
UIntPtr inputCount,
IntPtr[] outputNames,
UIntPtr outputCount,
IntPtr[] outputValues /* An array of output value pointers. Array must be allocated by the caller */
);
public static DOrtRun OrtRun;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(ONNStatus*)*/ DOrtRunWithBinding(
IntPtr /*(OrtSession*)*/ session,
IntPtr /*(OrtSessionRunOptions*)*/ runOptions, // can not be null
IntPtr /*(const OrtIoBinding*)*/ io_binding
);
public static DOrtRunWithBinding OrtRunWithBinding;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetInputCount(
IntPtr /*(OrtSession*)*/ session,
out UIntPtr count);
public static DOrtSessionGetInputCount OrtSessionGetInputCount;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetOutputCount(
IntPtr /*(OrtSession*)*/ session,
out UIntPtr count);
public static DOrtSessionGetOutputCount OrtSessionGetOutputCount;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetOverridableInitializerCount(
IntPtr /*(OrtSession*)*/ session,
out UIntPtr count);
public static DOrtSessionGetOverridableInitializerCount OrtSessionGetOverridableInitializerCount;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetInputName(
IntPtr /*(OrtSession*)*/ session,
UIntPtr index,
IntPtr /*(OrtAllocator*)*/ allocator,
out IntPtr /*(char**)*/name);
public static DOrtSessionGetInputName OrtSessionGetInputName;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetOutputName(
IntPtr /*(OrtSession*)*/ session,
UIntPtr index,
IntPtr /*(OrtAllocator*)*/ allocator,
out IntPtr /*(char**)*/name);
public static DOrtSessionGetOutputName OrtSessionGetOutputName;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/DOrtSessionEndProfiling(
IntPtr /*(const OrtSession*)*/ session,
IntPtr /*(OrtAllocator*)*/ allocator,
out IntPtr /*(char**)*/profile_file);
public static DOrtSessionEndProfiling OrtSessionEndProfiling;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetOverridableInitializerName(
IntPtr /*(OrtSession*)*/ session,
UIntPtr index,
IntPtr /*(OrtAllocator*)*/ allocator,
out IntPtr /*(char**)*/name);
public static DOrtSessionGetOverridableInitializerName OrtSessionGetOverridableInitializerName;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetInputTypeInfo(
IntPtr /*(const OrtSession*)*/ session,
UIntPtr index,
out IntPtr /*(struct OrtTypeInfo**)*/ typeInfo);
public static DOrtSessionGetInputTypeInfo OrtSessionGetInputTypeInfo;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetOutputTypeInfo(
IntPtr /*(const OrtSession*)*/ session,
UIntPtr index,
out IntPtr /* (struct OrtTypeInfo**)*/ typeInfo);
public static DOrtSessionGetOutputTypeInfo OrtSessionGetOutputTypeInfo;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetOverridableInitializerTypeInfo(
IntPtr /*(const OrtSession*)*/ session,
UIntPtr index,
out IntPtr /* (struct OrtTypeInfo**)*/ typeInfo);
public static DOrtSessionGetOverridableInitializerTypeInfo OrtSessionGetOverridableInitializerTypeInfo;
// release the typeinfo using OrtReleaseTypeInfo
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void DOrtReleaseTypeInfo(IntPtr /*(OrtTypeInfo*)*/session);
public static DOrtReleaseTypeInfo OrtReleaseTypeInfo;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void DOrtReleaseSession(IntPtr /*(OrtSession*)*/session);
public static DOrtReleaseSession OrtReleaseSession;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetProfilingStartTimeNs(
IntPtr /*(const OrtSession*)*/ session,
out UIntPtr /*(ulong* out)*/ startTime);
public static DOrtSessionGetProfilingStartTimeNs OrtSessionGetProfilingStartTimeNs;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(ONNStatus*)*/ DCreateAndRegisterAllocatorV2(
IntPtr /* (OrtEnv*) */ environment,
IntPtr /*(char*)*/ provider_type,
IntPtr /*(OrtMemoryInfo*)*/ mem_info,
IntPtr /*(OrtArenaCfg*)*/ arena_cfg,
IntPtr /*(char**)*/ provider_options_keys,
IntPtr /*(char**)*/ provider_options_values,
UIntPtr /*(size_t)*/num_keys);
public static DCreateAndRegisterAllocatorV2 OrtCreateAndRegisterAllocatorV2;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(ONNStatus*)*/ DOrtRunAsync(
IntPtr /*(OrtSession*)*/ session,
IntPtr /*(OrtSessionRunOptions*)*/ runOptions, // can be null to use the default options
IntPtr[] /*(char**)*/ inputNames,
IntPtr[] /*(OrtValue*[])*/ inputValues,
UIntPtr /*(size_t)*/ inputCount,
IntPtr[] /*(char**)*/ outputNames,
UIntPtr /*(size_t)*/ outputCount,
IntPtr[] /*(OrtValue*[])*/ outputValues,
IntPtr /*(void (*RunAsyncCallbackFn)(void* user_data, OrtValue** outputs, size_t num_outputs, OrtStatusPtr status))*/ callback, // callback function
IntPtr /*(void*)*/ user_data
);
public static DOrtRunAsync OrtRunAsync;
#endregion InferenceSession API
#region SessionOptions API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtCreateSessionOptions(out IntPtr /*(OrtSessionOptions**)*/ sessionOptions);
public static DOrtCreateSessionOptions OrtCreateSessionOptions;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void DOrtReleaseSessionOptions(IntPtr /*(OrtSessionOptions*)*/session);
public static DOrtReleaseSessionOptions OrtReleaseSessionOptions;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtCloneSessionOptions(IntPtr /*(OrtSessionOptions*)*/ sessionOptions, out IntPtr /*(OrtSessionOptions**)*/ output);
public static DOrtCloneSessionOptions OrtCloneSessionOptions;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSetSessionExecutionMode(IntPtr /*(OrtSessionOptions*)*/ options,
ExecutionMode execution_mode);
public static DOrtSetSessionExecutionMode OrtSetSessionExecutionMode;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSetOptimizedModelFilePath(IntPtr /* OrtSessionOptions* */ options, byte[] optimizedModelFilepath);
public static DOrtSetOptimizedModelFilePath OrtSetOptimizedModelFilePath;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtEnableProfiling(IntPtr /* OrtSessionOptions* */ options, byte[] profilePathPrefix);
public static DOrtEnableProfiling OrtEnableProfiling;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtDisableProfiling(IntPtr /* OrtSessionOptions* */ options);
public static DOrtDisableProfiling OrtDisableProfiling;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtEnableMemPattern(IntPtr /* OrtSessionOptions* */ options);
public static DOrtEnableMemPattern OrtEnableMemPattern;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtDisableMemPattern(IntPtr /* OrtSessionOptions* */ options);
public static DOrtDisableMemPattern OrtDisableMemPattern;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtEnableCpuMemArena(IntPtr /* OrtSessionOptions* */ options);
public static DOrtEnableCpuMemArena OrtEnableCpuMemArena;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtDisableCpuMemArena(IntPtr /* OrtSessionOptions* */ options);
public static DOrtDisableCpuMemArena OrtDisableCpuMemArena;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSetSessionLogId(IntPtr /* OrtSessionOptions* */ options, byte[] /* const char* */logId);
public static DOrtSetSessionLogId OrtSetSessionLogId;