1#[repr(C)]
7#[derive(Default)]
8pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);
9impl<T> __IncompleteArrayField<T> {
10 #[inline]
11 pub const fn new() -> Self {
12 __IncompleteArrayField(::std::marker::PhantomData, [])
13 }
14
15 #[inline]
16 pub fn as_ptr(&self) -> *const T {
17 self as *const _ as *const T
18 }
19
20 #[inline]
21 pub fn as_mut_ptr(&mut self) -> *mut T {
22 self as *mut _ as *mut T
23 }
24
25 #[inline]
26 pub unsafe fn as_slice(&self, len: usize) -> &[T] {
27 unsafe { ::std::slice::from_raw_parts(self.as_ptr(), len) }
28 }
29
30 #[inline]
31 pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
32 unsafe { ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) }
33 }
34}
35impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
36 fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
37 fmt.write_str("__IncompleteArrayField")
38 }
39}
40pub type va_list = __builtin_va_list;
41pub const TfLiteBuiltinOperator_kTfLiteBuiltinAdd: TfLiteBuiltinOperator = 0;
42pub const TfLiteBuiltinOperator_kTfLiteBuiltinAveragePool2d: TfLiteBuiltinOperator = 1;
43pub const TfLiteBuiltinOperator_kTfLiteBuiltinConcatenation: TfLiteBuiltinOperator = 2;
44pub const TfLiteBuiltinOperator_kTfLiteBuiltinConv2d: TfLiteBuiltinOperator = 3;
45pub const TfLiteBuiltinOperator_kTfLiteBuiltinDepthwiseConv2d: TfLiteBuiltinOperator = 4;
46pub const TfLiteBuiltinOperator_kTfLiteBuiltinDepthToSpace: TfLiteBuiltinOperator = 5;
47pub const TfLiteBuiltinOperator_kTfLiteBuiltinDequantize: TfLiteBuiltinOperator = 6;
48pub const TfLiteBuiltinOperator_kTfLiteBuiltinEmbeddingLookup: TfLiteBuiltinOperator = 7;
49pub const TfLiteBuiltinOperator_kTfLiteBuiltinFloor: TfLiteBuiltinOperator = 8;
50pub const TfLiteBuiltinOperator_kTfLiteBuiltinFullyConnected: TfLiteBuiltinOperator = 9;
51pub const TfLiteBuiltinOperator_kTfLiteBuiltinHashtableLookup: TfLiteBuiltinOperator = 10;
52pub const TfLiteBuiltinOperator_kTfLiteBuiltinL2Normalization: TfLiteBuiltinOperator = 11;
53pub const TfLiteBuiltinOperator_kTfLiteBuiltinL2Pool2d: TfLiteBuiltinOperator = 12;
54pub const TfLiteBuiltinOperator_kTfLiteBuiltinLocalResponseNormalization: TfLiteBuiltinOperator =
55 13;
56pub const TfLiteBuiltinOperator_kTfLiteBuiltinLogistic: TfLiteBuiltinOperator = 14;
57pub const TfLiteBuiltinOperator_kTfLiteBuiltinLshProjection: TfLiteBuiltinOperator = 15;
58pub const TfLiteBuiltinOperator_kTfLiteBuiltinLstm: TfLiteBuiltinOperator = 16;
59pub const TfLiteBuiltinOperator_kTfLiteBuiltinMaxPool2d: TfLiteBuiltinOperator = 17;
60pub const TfLiteBuiltinOperator_kTfLiteBuiltinMul: TfLiteBuiltinOperator = 18;
61pub const TfLiteBuiltinOperator_kTfLiteBuiltinRelu: TfLiteBuiltinOperator = 19;
62pub const TfLiteBuiltinOperator_kTfLiteBuiltinReluN1To1: TfLiteBuiltinOperator = 20;
63pub const TfLiteBuiltinOperator_kTfLiteBuiltinRelu6: TfLiteBuiltinOperator = 21;
64pub const TfLiteBuiltinOperator_kTfLiteBuiltinReshape: TfLiteBuiltinOperator = 22;
65pub const TfLiteBuiltinOperator_kTfLiteBuiltinResizeBilinear: TfLiteBuiltinOperator = 23;
66pub const TfLiteBuiltinOperator_kTfLiteBuiltinRnn: TfLiteBuiltinOperator = 24;
67pub const TfLiteBuiltinOperator_kTfLiteBuiltinSoftmax: TfLiteBuiltinOperator = 25;
68pub const TfLiteBuiltinOperator_kTfLiteBuiltinSpaceToDepth: TfLiteBuiltinOperator = 26;
69pub const TfLiteBuiltinOperator_kTfLiteBuiltinSvdf: TfLiteBuiltinOperator = 27;
70pub const TfLiteBuiltinOperator_kTfLiteBuiltinTanh: TfLiteBuiltinOperator = 28;
71pub const TfLiteBuiltinOperator_kTfLiteBuiltinConcatEmbeddings: TfLiteBuiltinOperator = 29;
72pub const TfLiteBuiltinOperator_kTfLiteBuiltinSkipGram: TfLiteBuiltinOperator = 30;
73pub const TfLiteBuiltinOperator_kTfLiteBuiltinCall: TfLiteBuiltinOperator = 31;
74pub const TfLiteBuiltinOperator_kTfLiteBuiltinCustom: TfLiteBuiltinOperator = 32;
75pub const TfLiteBuiltinOperator_kTfLiteBuiltinEmbeddingLookupSparse: TfLiteBuiltinOperator = 33;
76pub const TfLiteBuiltinOperator_kTfLiteBuiltinPad: TfLiteBuiltinOperator = 34;
77pub const TfLiteBuiltinOperator_kTfLiteBuiltinUnidirectionalSequenceRnn: TfLiteBuiltinOperator = 35;
78pub const TfLiteBuiltinOperator_kTfLiteBuiltinGather: TfLiteBuiltinOperator = 36;
79pub const TfLiteBuiltinOperator_kTfLiteBuiltinBatchToSpaceNd: TfLiteBuiltinOperator = 37;
80pub const TfLiteBuiltinOperator_kTfLiteBuiltinSpaceToBatchNd: TfLiteBuiltinOperator = 38;
81pub const TfLiteBuiltinOperator_kTfLiteBuiltinTranspose: TfLiteBuiltinOperator = 39;
82pub const TfLiteBuiltinOperator_kTfLiteBuiltinMean: TfLiteBuiltinOperator = 40;
83pub const TfLiteBuiltinOperator_kTfLiteBuiltinSub: TfLiteBuiltinOperator = 41;
84pub const TfLiteBuiltinOperator_kTfLiteBuiltinDiv: TfLiteBuiltinOperator = 42;
85pub const TfLiteBuiltinOperator_kTfLiteBuiltinSqueeze: TfLiteBuiltinOperator = 43;
86pub const TfLiteBuiltinOperator_kTfLiteBuiltinUnidirectionalSequenceLstm: TfLiteBuiltinOperator =
87 44;
88pub const TfLiteBuiltinOperator_kTfLiteBuiltinStridedSlice: TfLiteBuiltinOperator = 45;
89pub const TfLiteBuiltinOperator_kTfLiteBuiltinBidirectionalSequenceRnn: TfLiteBuiltinOperator = 46;
90pub const TfLiteBuiltinOperator_kTfLiteBuiltinExp: TfLiteBuiltinOperator = 47;
91pub const TfLiteBuiltinOperator_kTfLiteBuiltinTopkV2: TfLiteBuiltinOperator = 48;
92pub const TfLiteBuiltinOperator_kTfLiteBuiltinSplit: TfLiteBuiltinOperator = 49;
93pub const TfLiteBuiltinOperator_kTfLiteBuiltinLogSoftmax: TfLiteBuiltinOperator = 50;
94pub const TfLiteBuiltinOperator_kTfLiteBuiltinDelegate: TfLiteBuiltinOperator = 51;
95pub const TfLiteBuiltinOperator_kTfLiteBuiltinBidirectionalSequenceLstm: TfLiteBuiltinOperator = 52;
96pub const TfLiteBuiltinOperator_kTfLiteBuiltinCast: TfLiteBuiltinOperator = 53;
97pub const TfLiteBuiltinOperator_kTfLiteBuiltinPrelu: TfLiteBuiltinOperator = 54;
98pub const TfLiteBuiltinOperator_kTfLiteBuiltinMaximum: TfLiteBuiltinOperator = 55;
99pub const TfLiteBuiltinOperator_kTfLiteBuiltinArgMax: TfLiteBuiltinOperator = 56;
100pub const TfLiteBuiltinOperator_kTfLiteBuiltinMinimum: TfLiteBuiltinOperator = 57;
101pub const TfLiteBuiltinOperator_kTfLiteBuiltinLess: TfLiteBuiltinOperator = 58;
102pub const TfLiteBuiltinOperator_kTfLiteBuiltinNeg: TfLiteBuiltinOperator = 59;
103pub const TfLiteBuiltinOperator_kTfLiteBuiltinPadv2: TfLiteBuiltinOperator = 60;
104pub const TfLiteBuiltinOperator_kTfLiteBuiltinGreater: TfLiteBuiltinOperator = 61;
105pub const TfLiteBuiltinOperator_kTfLiteBuiltinGreaterEqual: TfLiteBuiltinOperator = 62;
106pub const TfLiteBuiltinOperator_kTfLiteBuiltinLessEqual: TfLiteBuiltinOperator = 63;
107pub const TfLiteBuiltinOperator_kTfLiteBuiltinSelect: TfLiteBuiltinOperator = 64;
108pub const TfLiteBuiltinOperator_kTfLiteBuiltinSlice: TfLiteBuiltinOperator = 65;
109pub const TfLiteBuiltinOperator_kTfLiteBuiltinSin: TfLiteBuiltinOperator = 66;
110pub const TfLiteBuiltinOperator_kTfLiteBuiltinTransposeConv: TfLiteBuiltinOperator = 67;
111pub const TfLiteBuiltinOperator_kTfLiteBuiltinSparseToDense: TfLiteBuiltinOperator = 68;
112pub const TfLiteBuiltinOperator_kTfLiteBuiltinTile: TfLiteBuiltinOperator = 69;
113pub const TfLiteBuiltinOperator_kTfLiteBuiltinExpandDims: TfLiteBuiltinOperator = 70;
114pub const TfLiteBuiltinOperator_kTfLiteBuiltinEqual: TfLiteBuiltinOperator = 71;
115pub const TfLiteBuiltinOperator_kTfLiteBuiltinNotEqual: TfLiteBuiltinOperator = 72;
116pub const TfLiteBuiltinOperator_kTfLiteBuiltinLog: TfLiteBuiltinOperator = 73;
117pub const TfLiteBuiltinOperator_kTfLiteBuiltinSum: TfLiteBuiltinOperator = 74;
118pub const TfLiteBuiltinOperator_kTfLiteBuiltinSqrt: TfLiteBuiltinOperator = 75;
119pub const TfLiteBuiltinOperator_kTfLiteBuiltinRsqrt: TfLiteBuiltinOperator = 76;
120pub const TfLiteBuiltinOperator_kTfLiteBuiltinShape: TfLiteBuiltinOperator = 77;
121pub const TfLiteBuiltinOperator_kTfLiteBuiltinPow: TfLiteBuiltinOperator = 78;
122pub const TfLiteBuiltinOperator_kTfLiteBuiltinArgMin: TfLiteBuiltinOperator = 79;
123pub const TfLiteBuiltinOperator_kTfLiteBuiltinFakeQuant: TfLiteBuiltinOperator = 80;
124pub const TfLiteBuiltinOperator_kTfLiteBuiltinReduceProd: TfLiteBuiltinOperator = 81;
125pub const TfLiteBuiltinOperator_kTfLiteBuiltinReduceMax: TfLiteBuiltinOperator = 82;
126pub const TfLiteBuiltinOperator_kTfLiteBuiltinPack: TfLiteBuiltinOperator = 83;
127pub const TfLiteBuiltinOperator_kTfLiteBuiltinLogicalOr: TfLiteBuiltinOperator = 84;
128pub const TfLiteBuiltinOperator_kTfLiteBuiltinOneHot: TfLiteBuiltinOperator = 85;
129pub const TfLiteBuiltinOperator_kTfLiteBuiltinLogicalAnd: TfLiteBuiltinOperator = 86;
130pub const TfLiteBuiltinOperator_kTfLiteBuiltinLogicalNot: TfLiteBuiltinOperator = 87;
131pub const TfLiteBuiltinOperator_kTfLiteBuiltinUnpack: TfLiteBuiltinOperator = 88;
132pub const TfLiteBuiltinOperator_kTfLiteBuiltinReduceMin: TfLiteBuiltinOperator = 89;
133pub const TfLiteBuiltinOperator_kTfLiteBuiltinFloorDiv: TfLiteBuiltinOperator = 90;
134pub const TfLiteBuiltinOperator_kTfLiteBuiltinReduceAny: TfLiteBuiltinOperator = 91;
135pub const TfLiteBuiltinOperator_kTfLiteBuiltinSquare: TfLiteBuiltinOperator = 92;
136pub const TfLiteBuiltinOperator_kTfLiteBuiltinZerosLike: TfLiteBuiltinOperator = 93;
137pub const TfLiteBuiltinOperator_kTfLiteBuiltinFill: TfLiteBuiltinOperator = 94;
138pub const TfLiteBuiltinOperator_kTfLiteBuiltinFloorMod: TfLiteBuiltinOperator = 95;
139pub const TfLiteBuiltinOperator_kTfLiteBuiltinRange: TfLiteBuiltinOperator = 96;
140pub const TfLiteBuiltinOperator_kTfLiteBuiltinResizeNearestNeighbor: TfLiteBuiltinOperator = 97;
141pub const TfLiteBuiltinOperator_kTfLiteBuiltinLeakyRelu: TfLiteBuiltinOperator = 98;
142pub const TfLiteBuiltinOperator_kTfLiteBuiltinSquaredDifference: TfLiteBuiltinOperator = 99;
143pub const TfLiteBuiltinOperator_kTfLiteBuiltinMirrorPad: TfLiteBuiltinOperator = 100;
144pub const TfLiteBuiltinOperator_kTfLiteBuiltinAbs: TfLiteBuiltinOperator = 101;
145pub const TfLiteBuiltinOperator_kTfLiteBuiltinSplitV: TfLiteBuiltinOperator = 102;
146pub const TfLiteBuiltinOperator_kTfLiteBuiltinUnique: TfLiteBuiltinOperator = 103;
147pub const TfLiteBuiltinOperator_kTfLiteBuiltinCeil: TfLiteBuiltinOperator = 104;
148pub const TfLiteBuiltinOperator_kTfLiteBuiltinReverseV2: TfLiteBuiltinOperator = 105;
149pub const TfLiteBuiltinOperator_kTfLiteBuiltinAddN: TfLiteBuiltinOperator = 106;
150pub const TfLiteBuiltinOperator_kTfLiteBuiltinGatherNd: TfLiteBuiltinOperator = 107;
151pub const TfLiteBuiltinOperator_kTfLiteBuiltinCos: TfLiteBuiltinOperator = 108;
152pub const TfLiteBuiltinOperator_kTfLiteBuiltinWhere: TfLiteBuiltinOperator = 109;
153pub const TfLiteBuiltinOperator_kTfLiteBuiltinRank: TfLiteBuiltinOperator = 110;
154pub const TfLiteBuiltinOperator_kTfLiteBuiltinElu: TfLiteBuiltinOperator = 111;
155pub const TfLiteBuiltinOperator_kTfLiteBuiltinReverseSequence: TfLiteBuiltinOperator = 112;
156pub const TfLiteBuiltinOperator_kTfLiteBuiltinMatrixDiag: TfLiteBuiltinOperator = 113;
157pub const TfLiteBuiltinOperator_kTfLiteBuiltinQuantize: TfLiteBuiltinOperator = 114;
158pub const TfLiteBuiltinOperator_kTfLiteBuiltinMatrixSetDiag: TfLiteBuiltinOperator = 115;
159pub const TfLiteBuiltinOperator_kTfLiteBuiltinRound: TfLiteBuiltinOperator = 116;
160pub const TfLiteBuiltinOperator_kTfLiteBuiltinHardSwish: TfLiteBuiltinOperator = 117;
161pub const TfLiteBuiltinOperator_kTfLiteBuiltinIf: TfLiteBuiltinOperator = 118;
162pub const TfLiteBuiltinOperator_kTfLiteBuiltinWhile: TfLiteBuiltinOperator = 119;
163pub const TfLiteBuiltinOperator_kTfLiteBuiltinNonMaxSuppressionV4: TfLiteBuiltinOperator = 120;
164pub const TfLiteBuiltinOperator_kTfLiteBuiltinNonMaxSuppressionV5: TfLiteBuiltinOperator = 121;
165pub const TfLiteBuiltinOperator_kTfLiteBuiltinScatterNd: TfLiteBuiltinOperator = 122;
166pub const TfLiteBuiltinOperator_kTfLiteBuiltinSelectV2: TfLiteBuiltinOperator = 123;
167pub const TfLiteBuiltinOperator_kTfLiteBuiltinDensify: TfLiteBuiltinOperator = 124;
168pub const TfLiteBuiltinOperator_kTfLiteBuiltinSegmentSum: TfLiteBuiltinOperator = 125;
169pub const TfLiteBuiltinOperator_kTfLiteBuiltinBatchMatmul: TfLiteBuiltinOperator = 126;
170pub const TfLiteBuiltinOperator_kTfLiteBuiltinPlaceholderForGreaterOpCodes: TfLiteBuiltinOperator =
171 127;
172pub const TfLiteBuiltinOperator_kTfLiteBuiltinCumsum: TfLiteBuiltinOperator = 128;
173pub const TfLiteBuiltinOperator_kTfLiteBuiltinCallOnce: TfLiteBuiltinOperator = 129;
174pub const TfLiteBuiltinOperator_kTfLiteBuiltinBroadcastTo: TfLiteBuiltinOperator = 130;
175pub const TfLiteBuiltinOperator_kTfLiteBuiltinRfft2d: TfLiteBuiltinOperator = 131;
176pub const TfLiteBuiltinOperator_kTfLiteBuiltinConv3d: TfLiteBuiltinOperator = 132;
177pub const TfLiteBuiltinOperator_kTfLiteBuiltinImag: TfLiteBuiltinOperator = 133;
178pub const TfLiteBuiltinOperator_kTfLiteBuiltinReal: TfLiteBuiltinOperator = 134;
179pub const TfLiteBuiltinOperator_kTfLiteBuiltinComplexAbs: TfLiteBuiltinOperator = 135;
180pub const TfLiteBuiltinOperator_kTfLiteBuiltinHashtable: TfLiteBuiltinOperator = 136;
181pub const TfLiteBuiltinOperator_kTfLiteBuiltinHashtableFind: TfLiteBuiltinOperator = 137;
182pub const TfLiteBuiltinOperator_kTfLiteBuiltinHashtableImport: TfLiteBuiltinOperator = 138;
183pub const TfLiteBuiltinOperator_kTfLiteBuiltinHashtableSize: TfLiteBuiltinOperator = 139;
184pub const TfLiteBuiltinOperator_kTfLiteBuiltinReduceAll: TfLiteBuiltinOperator = 140;
185pub const TfLiteBuiltinOperator_kTfLiteBuiltinConv3dTranspose: TfLiteBuiltinOperator = 141;
186pub const TfLiteBuiltinOperator_kTfLiteBuiltinVarHandle: TfLiteBuiltinOperator = 142;
187pub const TfLiteBuiltinOperator_kTfLiteBuiltinReadVariable: TfLiteBuiltinOperator = 143;
188pub const TfLiteBuiltinOperator_kTfLiteBuiltinAssignVariable: TfLiteBuiltinOperator = 144;
189pub const TfLiteBuiltinOperator_kTfLiteBuiltinBroadcastArgs: TfLiteBuiltinOperator = 145;
190pub const TfLiteBuiltinOperator_kTfLiteBuiltinRandomStandardNormal: TfLiteBuiltinOperator = 146;
191pub const TfLiteBuiltinOperator_kTfLiteBuiltinBucketize: TfLiteBuiltinOperator = 147;
192pub const TfLiteBuiltinOperator_kTfLiteBuiltinRandomUniform: TfLiteBuiltinOperator = 148;
193pub const TfLiteBuiltinOperator_kTfLiteBuiltinMultinomial: TfLiteBuiltinOperator = 149;
194pub const TfLiteBuiltinOperator_kTfLiteBuiltinGelu: TfLiteBuiltinOperator = 150;
195pub const TfLiteBuiltinOperator_kTfLiteBuiltinDynamicUpdateSlice: TfLiteBuiltinOperator = 151;
196pub const TfLiteBuiltinOperator_kTfLiteBuiltinRelu0To1: TfLiteBuiltinOperator = 152;
197pub const TfLiteBuiltinOperator_kTfLiteBuiltinUnsortedSegmentProd: TfLiteBuiltinOperator = 153;
198pub const TfLiteBuiltinOperator_kTfLiteBuiltinUnsortedSegmentMax: TfLiteBuiltinOperator = 154;
199pub const TfLiteBuiltinOperator_kTfLiteBuiltinUnsortedSegmentSum: TfLiteBuiltinOperator = 155;
200pub const TfLiteBuiltinOperator_kTfLiteBuiltinAtan2: TfLiteBuiltinOperator = 156;
201pub const TfLiteBuiltinOperator_kTfLiteBuiltinUnsortedSegmentMin: TfLiteBuiltinOperator = 157;
202pub const TfLiteBuiltinOperator_kTfLiteBuiltinSign: TfLiteBuiltinOperator = 158;
203pub const TfLiteBuiltinOperator_kTfLiteBuiltinBitcast: TfLiteBuiltinOperator = 159;
204pub const TfLiteBuiltinOperator_kTfLiteBuiltinBitwiseXor: TfLiteBuiltinOperator = 160;
205pub const TfLiteBuiltinOperator_kTfLiteBuiltinRightShift: TfLiteBuiltinOperator = 161;
206pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloLogistic: TfLiteBuiltinOperator = 162;
207pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloAdd: TfLiteBuiltinOperator = 163;
208pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloDivide: TfLiteBuiltinOperator = 164;
209pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloMultiply: TfLiteBuiltinOperator = 165;
210pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloMaximum: TfLiteBuiltinOperator = 166;
211pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloReshape: TfLiteBuiltinOperator = 167;
212pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloClamp: TfLiteBuiltinOperator = 168;
213pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloConcatenate: TfLiteBuiltinOperator = 169;
214pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloBroadcastInDim: TfLiteBuiltinOperator = 170;
215pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloConvolution: TfLiteBuiltinOperator = 171;
216pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloSlice: TfLiteBuiltinOperator = 172;
217pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloCustomCall: TfLiteBuiltinOperator = 173;
218pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloReduce: TfLiteBuiltinOperator = 174;
219pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloAbs: TfLiteBuiltinOperator = 175;
220pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloAnd: TfLiteBuiltinOperator = 176;
221pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloCosine: TfLiteBuiltinOperator = 177;
222pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloExponential: TfLiteBuiltinOperator = 178;
223pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloFloor: TfLiteBuiltinOperator = 179;
224pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloLog: TfLiteBuiltinOperator = 180;
225pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloMinimum: TfLiteBuiltinOperator = 181;
226pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloNegate: TfLiteBuiltinOperator = 182;
227pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloOr: TfLiteBuiltinOperator = 183;
228pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloPower: TfLiteBuiltinOperator = 184;
229pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloRemainder: TfLiteBuiltinOperator = 185;
230pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloRsqrt: TfLiteBuiltinOperator = 186;
231pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloSelect: TfLiteBuiltinOperator = 187;
232pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloSubtract: TfLiteBuiltinOperator = 188;
233pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloTanh: TfLiteBuiltinOperator = 189;
234pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloScatter: TfLiteBuiltinOperator = 190;
235pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloCompare: TfLiteBuiltinOperator = 191;
236pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloConvert: TfLiteBuiltinOperator = 192;
237pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloDynamicSlice: TfLiteBuiltinOperator = 193;
238pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloDynamicUpdateSlice: TfLiteBuiltinOperator =
239 194;
240pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloPad: TfLiteBuiltinOperator = 195;
241pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloIota: TfLiteBuiltinOperator = 196;
242pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloDotGeneral: TfLiteBuiltinOperator = 197;
243pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloReduceWindow: TfLiteBuiltinOperator = 198;
244pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloSort: TfLiteBuiltinOperator = 199;
245pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloWhile: TfLiteBuiltinOperator = 200;
246pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloGather: TfLiteBuiltinOperator = 201;
247pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloTranspose: TfLiteBuiltinOperator = 202;
248pub const TfLiteBuiltinOperator_kTfLiteBuiltinDilate: TfLiteBuiltinOperator = 203;
249pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloRngBitGenerator: TfLiteBuiltinOperator = 204;
250pub const TfLiteBuiltinOperator_kTfLiteBuiltinReduceWindow: TfLiteBuiltinOperator = 205;
251pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloComposite: TfLiteBuiltinOperator = 206;
252pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloShiftLeft: TfLiteBuiltinOperator = 207;
253pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloCbrt: TfLiteBuiltinOperator = 208;
254pub const TfLiteBuiltinOperator_kTfLiteBuiltinStablehloCase: TfLiteBuiltinOperator = 209;
255pub type TfLiteBuiltinOperator = ::std::os::raw::c_uint;
256#[repr(C)]
257#[derive(Debug, Copy, Clone)]
258pub struct TfLiteAsyncKernel {
259 _unused: [u8; 0],
260}
261pub const TfLiteType_kTfLiteNoType: TfLiteType = 0;
262pub const TfLiteType_kTfLiteFloat32: TfLiteType = 1;
263pub const TfLiteType_kTfLiteInt32: TfLiteType = 2;
264pub const TfLiteType_kTfLiteUInt8: TfLiteType = 3;
265pub const TfLiteType_kTfLiteInt64: TfLiteType = 4;
266pub const TfLiteType_kTfLiteString: TfLiteType = 5;
267pub const TfLiteType_kTfLiteBool: TfLiteType = 6;
268pub const TfLiteType_kTfLiteInt16: TfLiteType = 7;
269pub const TfLiteType_kTfLiteComplex64: TfLiteType = 8;
270pub const TfLiteType_kTfLiteInt8: TfLiteType = 9;
271pub const TfLiteType_kTfLiteFloat16: TfLiteType = 10;
272pub const TfLiteType_kTfLiteFloat64: TfLiteType = 11;
273pub const TfLiteType_kTfLiteComplex128: TfLiteType = 12;
274pub const TfLiteType_kTfLiteUInt64: TfLiteType = 13;
275pub const TfLiteType_kTfLiteResource: TfLiteType = 14;
276pub const TfLiteType_kTfLiteVariant: TfLiteType = 15;
277pub const TfLiteType_kTfLiteUInt32: TfLiteType = 16;
278pub const TfLiteType_kTfLiteUInt16: TfLiteType = 17;
279pub const TfLiteType_kTfLiteInt4: TfLiteType = 18;
280pub const TfLiteType_kTfLiteBFloat16: TfLiteType = 19;
281#[doc = " Types supported by tensor"]
282pub type TfLiteType = ::std::os::raw::c_uint;
283#[doc = " Legacy. Will be deprecated in favor of `TfLiteAffineQuantization`.\n If per-layer quantization is specified this field will still be populated in\n addition to `TfLiteAffineQuantization`.\n Parameters for asymmetric quantization. Quantized values can be converted\n back to float using: `real_value = scale * (quantized_value - zero_point)`"]
284#[repr(C)]
285#[derive(Debug, Copy, Clone)]
286pub struct TfLiteQuantizationParams {
287 pub scale: f32,
288 pub zero_point: i32,
289}
290#[allow(clippy::unnecessary_operation, clippy::identity_op)]
291const _: () = {
292 ["Size of TfLiteQuantizationParams"]
293 [::std::mem::size_of::<TfLiteQuantizationParams>() - 8usize];
294 ["Alignment of TfLiteQuantizationParams"]
295 [::std::mem::align_of::<TfLiteQuantizationParams>() - 4usize];
296 ["Offset of field: TfLiteQuantizationParams::scale"]
297 [::std::mem::offset_of!(TfLiteQuantizationParams, scale) - 0usize];
298 ["Offset of field: TfLiteQuantizationParams::zero_point"]
299 [::std::mem::offset_of!(TfLiteQuantizationParams, zero_point) - 4usize];
300};
301pub const TfLiteDimensionType_kTfLiteDimDense: TfLiteDimensionType = 0;
302pub const TfLiteDimensionType_kTfLiteDimSparseCSR: TfLiteDimensionType = 1;
303#[doc = " Storage format of each dimension in a sparse tensor."]
304pub type TfLiteDimensionType = ::std::os::raw::c_uint;
305#[doc = " Success"]
306pub const TfLiteStatus_kTfLiteOk: TfLiteStatus = 0;
307#[doc = " Generally referring to an error in the runtime (i.e. interpreter)"]
308pub const TfLiteStatus_kTfLiteError: TfLiteStatus = 1;
309#[doc = " Generally referring to an error from a TfLiteDelegate itself."]
310pub const TfLiteStatus_kTfLiteDelegateError: TfLiteStatus = 2;
311#[doc = " Generally referring to an error in applying a delegate due to\n incompatibility between runtime and delegate, e.g., this error is returned\n when trying to apply a TF Lite delegate onto a model graph that's already\n immutable."]
312pub const TfLiteStatus_kTfLiteApplicationError: TfLiteStatus = 3;
313#[doc = " Generally referring to serialized delegate data not being found.\n See tflite::delegates::Serialization."]
314pub const TfLiteStatus_kTfLiteDelegateDataNotFound: TfLiteStatus = 4;
315#[doc = " Generally referring to data-writing issues in delegate serialization.\n See tflite::delegates::Serialization."]
316pub const TfLiteStatus_kTfLiteDelegateDataWriteError: TfLiteStatus = 5;
317#[doc = " Generally referring to data-reading issues in delegate serialization.\n See tflite::delegates::Serialization."]
318pub const TfLiteStatus_kTfLiteDelegateDataReadError: TfLiteStatus = 6;
319#[doc = " Generally referring to issues when the TF Lite model has ops that cannot\n be resolved at runtime. This could happen when the specific op is not\n registered or built with the TF Lite framework."]
320pub const TfLiteStatus_kTfLiteUnresolvedOps: TfLiteStatus = 7;
321#[doc = " Generally referring to invocation cancelled by the user.\n See `interpreter::Cancel`."]
322pub const TfLiteStatus_kTfLiteCancelled: TfLiteStatus = 8;
323#[doc = " Generally referring to invocation cancelled by the user.\n See `interpreter::Cancel`."]
324pub const TfLiteStatus_kTfLiteOutputShapeNotKnown: TfLiteStatus = 9;
325#[doc = " Note that new error status values may be added in future in order to\n indicate more fine-grained internal states, therefore, applications should\n not rely on status values being members of the enum."]
326pub type TfLiteStatus = ::std::os::raw::c_uint;
327#[repr(C)]
328#[derive(Debug, Copy, Clone)]
329pub struct TfLiteOpaqueContext {
330 _unused: [u8; 0],
331}
332#[repr(C)]
333#[derive(Debug, Copy, Clone)]
334pub struct TfLiteOpaqueNode {
335 _unused: [u8; 0],
336}
337#[repr(C)]
338#[derive(Debug, Copy, Clone)]
339pub struct TfLiteOpaqueTensor {
340 _unused: [u8; 0],
341}
342#[doc = " WARNING: This is an experimental interface that is subject to change."]
343pub type TfLiteOpaqueDelegate = TfLiteDelegate;
344#[repr(C)]
345#[derive(Debug, Copy, Clone)]
346pub struct TfLiteOperator {
347 _unused: [u8; 0],
348}
349#[repr(C)]
350#[derive(Debug, Copy, Clone)]
351pub struct TfLiteModel {
352 _unused: [u8; 0],
353}
354#[repr(C)]
355#[derive(Debug, Copy, Clone)]
356pub struct TfLiteInterpreterOptions {
357 _unused: [u8; 0],
358}
359#[repr(C)]
360#[derive(Debug, Copy, Clone)]
361pub struct TfLiteInterpreter {
362 _unused: [u8; 0],
363}
364#[repr(C)]
365#[derive(Debug, Copy, Clone)]
366pub struct TfLiteSignatureRunner {
367 _unused: [u8; 0],
368}
369pub const TfLiteExternalContextType_kTfLiteEigenContext: TfLiteExternalContextType = 0;
370#[doc = " include eigen_support.h to use."]
371pub const TfLiteExternalContextType_kTfLiteGemmLowpContext: TfLiteExternalContextType = 1;
372#[doc = " include gemm_support.h to use."]
373pub const TfLiteExternalContextType_kTfLiteEdgeTpuContext: TfLiteExternalContextType = 2;
374#[doc = " Placeholder for Edge TPU support."]
375pub const TfLiteExternalContextType_kTfLiteCpuBackendContext: TfLiteExternalContextType = 3;
376#[doc = " include cpu_backend_context.h to use."]
377pub const TfLiteExternalContextType_kTfLiteLiteRtBufferContext: TfLiteExternalContextType = 4;
378#[doc = " include external_litert_buffer_context.h to use."]
379pub const TfLiteExternalContextType_kTfLiteMaxExternalContexts: TfLiteExternalContextType = 5;
380#[doc = " The list of external context types known to TF Lite. This list exists solely\n to avoid conflicts and to ensure ops can share the external contexts they\n need. Access to the external contexts is controlled by one of the\n corresponding support files."]
381pub type TfLiteExternalContextType = ::std::os::raw::c_uint;
382#[doc = " An external context is a collection of information unrelated to the TF Lite\n framework, but useful to a subset of the ops. TF Lite knows very little\n about the actual contexts, but it keeps a list of them, and is able to\n refresh them if configurations like the number of recommended threads\n change."]
383#[repr(C)]
384#[derive(Debug, Copy, Clone)]
385pub struct TfLiteExternalContext {
386 pub type_: TfLiteExternalContextType,
387 pub Refresh:
388 ::std::option::Option<unsafe extern "C" fn(context: *mut TfLiteContext) -> TfLiteStatus>,
389}
390#[allow(clippy::unnecessary_operation, clippy::identity_op)]
391const _: () = {
392 ["Size of TfLiteExternalContext"][::std::mem::size_of::<TfLiteExternalContext>() - 16usize];
393 ["Alignment of TfLiteExternalContext"]
394 [::std::mem::align_of::<TfLiteExternalContext>() - 8usize];
395 ["Offset of field: TfLiteExternalContext::type_"]
396 [::std::mem::offset_of!(TfLiteExternalContext, type_) - 0usize];
397 ["Offset of field: TfLiteExternalContext::Refresh"]
398 [::std::mem::offset_of!(TfLiteExternalContext, Refresh) - 8usize];
399};
400#[doc = " Fixed size list of integers. Used for dimensions and inputs/outputs tensor\n indices"]
401#[repr(C)]
402#[derive(Debug)]
403pub struct TfLiteIntArray {
404 pub size: ::std::os::raw::c_int,
405 pub data: __IncompleteArrayField<::std::os::raw::c_int>,
406}
407#[allow(clippy::unnecessary_operation, clippy::identity_op)]
408const _: () = {
409 ["Size of TfLiteIntArray"][::std::mem::size_of::<TfLiteIntArray>() - 4usize];
410 ["Alignment of TfLiteIntArray"][::std::mem::align_of::<TfLiteIntArray>() - 4usize];
411 ["Offset of field: TfLiteIntArray::size"]
412 [::std::mem::offset_of!(TfLiteIntArray, size) - 0usize];
413 ["Offset of field: TfLiteIntArray::data"]
414 [::std::mem::offset_of!(TfLiteIntArray, data) - 4usize];
415};
416#[doc = " Fixed size list of floats. Used for per-channel quantization."]
417#[repr(C)]
418#[derive(Debug)]
419pub struct TfLiteFloatArray {
420 pub size: ::std::os::raw::c_int,
421 pub data: __IncompleteArrayField<f32>,
422}
423#[allow(clippy::unnecessary_operation, clippy::identity_op)]
424const _: () = {
425 ["Size of TfLiteFloatArray"][::std::mem::size_of::<TfLiteFloatArray>() - 4usize];
426 ["Alignment of TfLiteFloatArray"][::std::mem::align_of::<TfLiteFloatArray>() - 4usize];
427 ["Offset of field: TfLiteFloatArray::size"]
428 [::std::mem::offset_of!(TfLiteFloatArray, size) - 0usize];
429 ["Offset of field: TfLiteFloatArray::data"]
430 [::std::mem::offset_of!(TfLiteFloatArray, data) - 4usize];
431};
432#[doc = " Single-precision complex data type compatible with the C99 definition."]
433#[repr(C)]
434#[derive(Debug, Copy, Clone)]
435pub struct TfLiteComplex64 {
436 pub re: f32,
437 pub im: f32,
438}
439#[allow(clippy::unnecessary_operation, clippy::identity_op)]
440const _: () = {
441 ["Size of TfLiteComplex64"][::std::mem::size_of::<TfLiteComplex64>() - 8usize];
442 ["Alignment of TfLiteComplex64"][::std::mem::align_of::<TfLiteComplex64>() - 4usize];
443 ["Offset of field: TfLiteComplex64::re"][::std::mem::offset_of!(TfLiteComplex64, re) - 0usize];
444 ["Offset of field: TfLiteComplex64::im"][::std::mem::offset_of!(TfLiteComplex64, im) - 4usize];
445};
446#[doc = " Double-precision complex data type compatible with the C99 definition."]
447#[repr(C)]
448#[derive(Debug, Copy, Clone)]
449pub struct TfLiteComplex128 {
450 pub re: f64,
451 pub im: f64,
452}
453#[allow(clippy::unnecessary_operation, clippy::identity_op)]
454const _: () = {
455 ["Size of TfLiteComplex128"][::std::mem::size_of::<TfLiteComplex128>() - 16usize];
456 ["Alignment of TfLiteComplex128"][::std::mem::align_of::<TfLiteComplex128>() - 8usize];
457 ["Offset of field: TfLiteComplex128::re"]
458 [::std::mem::offset_of!(TfLiteComplex128, re) - 0usize];
459 ["Offset of field: TfLiteComplex128::im"]
460 [::std::mem::offset_of!(TfLiteComplex128, im) - 8usize];
461};
462#[doc = " Half precision data type compatible with the C99 definition."]
463#[repr(C)]
464#[derive(Debug, Copy, Clone)]
465pub struct TfLiteFloat16 {
466 pub data: u16,
467}
468#[allow(clippy::unnecessary_operation, clippy::identity_op)]
469const _: () = {
470 ["Size of TfLiteFloat16"][::std::mem::size_of::<TfLiteFloat16>() - 2usize];
471 ["Alignment of TfLiteFloat16"][::std::mem::align_of::<TfLiteFloat16>() - 2usize];
472 ["Offset of field: TfLiteFloat16::data"][::std::mem::offset_of!(TfLiteFloat16, data) - 0usize];
473};
474#[doc = " bfloat16 data type compatible with the Google Brain definition.\n https://cloud.google.com/tpu/docs/bfloat16.\n This provides 1 bit of sign, 8 bits of exponent, and 7 bits of mantissa."]
475#[repr(C)]
476#[derive(Debug, Copy, Clone)]
477pub struct TfLiteBFloat16 {
478 pub data: u16,
479}
480#[allow(clippy::unnecessary_operation, clippy::identity_op)]
481const _: () = {
482 ["Size of TfLiteBFloat16"][::std::mem::size_of::<TfLiteBFloat16>() - 2usize];
483 ["Alignment of TfLiteBFloat16"][::std::mem::align_of::<TfLiteBFloat16>() - 2usize];
484 ["Offset of field: TfLiteBFloat16::data"]
485 [::std::mem::offset_of!(TfLiteBFloat16, data) - 0usize];
486};
487#[doc = " No quantization."]
488pub const TfLiteQuantizationType_kTfLiteNoQuantization: TfLiteQuantizationType = 0;
489#[doc = " Affine quantization (with support for per-channel quantization).\n Corresponds to TfLiteAffineQuantization."]
490pub const TfLiteQuantizationType_kTfLiteAffineQuantization: TfLiteQuantizationType = 1;
491#[doc = " SupportedQuantizationTypes."]
492pub type TfLiteQuantizationType = ::std::os::raw::c_int;
493#[doc = " Structure specifying the quantization used by the tensor, if-any."]
494#[repr(C)]
495#[derive(Debug, Copy, Clone)]
496pub struct TfLiteQuantization {
497 #[doc = " The type of quantization held by params."]
498 pub type_: TfLiteQuantizationType,
499 #[doc = " Holds an optional reference to a quantization param structure. The actual\n type depends on the value of the `type` field (see the comment there for\n the values and corresponding types)."]
500 pub params: *mut ::std::os::raw::c_void,
501}
502#[allow(clippy::unnecessary_operation, clippy::identity_op)]
503const _: () = {
504 ["Size of TfLiteQuantization"][::std::mem::size_of::<TfLiteQuantization>() - 16usize];
505 ["Alignment of TfLiteQuantization"][::std::mem::align_of::<TfLiteQuantization>() - 8usize];
506 ["Offset of field: TfLiteQuantization::type_"]
507 [::std::mem::offset_of!(TfLiteQuantization, type_) - 0usize];
508 ["Offset of field: TfLiteQuantization::params"]
509 [::std::mem::offset_of!(TfLiteQuantization, params) - 8usize];
510};
511#[doc = " A union of pointers that points to memory for a given tensor.\n\n Do not access these members directly, if possible, use\n `GetTensorData<TYPE>(tensor)` instead, otherwise only access `.data`, as\n other members are deprecated."]
512#[repr(C)]
513#[derive(Copy, Clone)]
514pub union TfLitePtrUnion {
515 pub i32_: *mut i32,
516 pub u32_: *mut u32,
517 pub i64_: *mut i64,
518 pub u64_: *mut u64,
519 pub f: *mut f32,
520 pub f16: *mut TfLiteFloat16,
521 pub bf16: *mut TfLiteBFloat16,
522 pub f64_: *mut f64,
523 pub raw: *mut ::std::os::raw::c_char,
524 pub raw_const: *const ::std::os::raw::c_char,
525 pub uint8: *mut u8,
526 pub b: *mut bool,
527 pub i16_: *mut i16,
528 pub ui16: *mut u16,
529 pub c64: *mut TfLiteComplex64,
530 pub c128: *mut TfLiteComplex128,
531 pub int8: *mut i8,
532 #[doc = " Only use this member."]
533 pub data: *mut ::std::os::raw::c_void,
534}
535#[allow(clippy::unnecessary_operation, clippy::identity_op)]
536const _: () = {
537 ["Size of TfLitePtrUnion"][::std::mem::size_of::<TfLitePtrUnion>() - 8usize];
538 ["Alignment of TfLitePtrUnion"][::std::mem::align_of::<TfLitePtrUnion>() - 8usize];
539 ["Offset of field: TfLitePtrUnion::i32_"]
540 [::std::mem::offset_of!(TfLitePtrUnion, i32_) - 0usize];
541 ["Offset of field: TfLitePtrUnion::u32_"]
542 [::std::mem::offset_of!(TfLitePtrUnion, u32_) - 0usize];
543 ["Offset of field: TfLitePtrUnion::i64_"]
544 [::std::mem::offset_of!(TfLitePtrUnion, i64_) - 0usize];
545 ["Offset of field: TfLitePtrUnion::u64_"]
546 [::std::mem::offset_of!(TfLitePtrUnion, u64_) - 0usize];
547 ["Offset of field: TfLitePtrUnion::f"][::std::mem::offset_of!(TfLitePtrUnion, f) - 0usize];
548 ["Offset of field: TfLitePtrUnion::f16"][::std::mem::offset_of!(TfLitePtrUnion, f16) - 0usize];
549 ["Offset of field: TfLitePtrUnion::bf16"]
550 [::std::mem::offset_of!(TfLitePtrUnion, bf16) - 0usize];
551 ["Offset of field: TfLitePtrUnion::f64_"]
552 [::std::mem::offset_of!(TfLitePtrUnion, f64_) - 0usize];
553 ["Offset of field: TfLitePtrUnion::raw"][::std::mem::offset_of!(TfLitePtrUnion, raw) - 0usize];
554 ["Offset of field: TfLitePtrUnion::raw_const"]
555 [::std::mem::offset_of!(TfLitePtrUnion, raw_const) - 0usize];
556 ["Offset of field: TfLitePtrUnion::uint8"]
557 [::std::mem::offset_of!(TfLitePtrUnion, uint8) - 0usize];
558 ["Offset of field: TfLitePtrUnion::b"][::std::mem::offset_of!(TfLitePtrUnion, b) - 0usize];
559 ["Offset of field: TfLitePtrUnion::i16_"]
560 [::std::mem::offset_of!(TfLitePtrUnion, i16_) - 0usize];
561 ["Offset of field: TfLitePtrUnion::ui16"]
562 [::std::mem::offset_of!(TfLitePtrUnion, ui16) - 0usize];
563 ["Offset of field: TfLitePtrUnion::c64"][::std::mem::offset_of!(TfLitePtrUnion, c64) - 0usize];
564 ["Offset of field: TfLitePtrUnion::c128"]
565 [::std::mem::offset_of!(TfLitePtrUnion, c128) - 0usize];
566 ["Offset of field: TfLitePtrUnion::int8"]
567 [::std::mem::offset_of!(TfLitePtrUnion, int8) - 0usize];
568 ["Offset of field: TfLitePtrUnion::data"]
569 [::std::mem::offset_of!(TfLitePtrUnion, data) - 0usize];
570};
571pub const TfLiteAllocationType_kTfLiteMemNone: TfLiteAllocationType = 0;
572pub const TfLiteAllocationType_kTfLiteMmapRo: TfLiteAllocationType = 1;
573pub const TfLiteAllocationType_kTfLiteArenaRw: TfLiteAllocationType = 2;
574pub const TfLiteAllocationType_kTfLiteArenaRwPersistent: TfLiteAllocationType = 3;
575pub const TfLiteAllocationType_kTfLiteDynamic: TfLiteAllocationType = 4;
576pub const TfLiteAllocationType_kTfLitePersistentRo: TfLiteAllocationType = 5;
577pub const TfLiteAllocationType_kTfLiteCustom: TfLiteAllocationType = 6;
578pub const TfLiteAllocationType_kTfLiteVariantObject: TfLiteAllocationType = 7;
579#[doc = " Memory allocation strategies.\n * `kTfLiteMmapRo`: Read-only memory-mapped data, or data externally\n allocated.\n * `kTfLiteArenaRw`: Arena allocated with no guarantees about persistence,\n and available during eval.\n * `kTfLiteArenaRwPersistent`: Arena allocated but persistent across eval,\n and only available during eval.\n * `kTfLiteDynamic`: Allocated during eval, or for string tensors.\n * `kTfLitePersistentRo`: Allocated and populated during prepare. This is\n useful for tensors that can be computed during prepare and treated\n as constant inputs for downstream ops (also in prepare).\n * `kTfLiteCustom`: Custom memory allocation provided by the user. See\n TfLiteCustomAllocation below.\n * `kTfLiteVariantObject`: Allocation is an arbitrary type-erased C++\n object.\n Allocation and deallocation are done through `new` and `delete`."]
580pub type TfLiteAllocationType = ::std::os::raw::c_uint;
581pub const TfLiteAllocationStrategy_kTfLiteAllocationStrategyUnknown: TfLiteAllocationStrategy = 0;
582pub const TfLiteAllocationStrategy_kTfLiteAllocationStrategyNone: TfLiteAllocationStrategy = 1;
583#[doc = " No data is allocated."]
584pub const TfLiteAllocationStrategy_kTfLiteAllocationStrategyMMap: TfLiteAllocationStrategy = 2;
585#[doc = " Data is mmaped."]
586pub const TfLiteAllocationStrategy_kTfLiteAllocationStrategyArena: TfLiteAllocationStrategy = 3;
587#[doc = " Handled by the arena."]
588pub const TfLiteAllocationStrategy_kTfLiteAllocationStrategyMalloc: TfLiteAllocationStrategy = 4;
589#[doc = " Uses `malloc`/`free`."]
590pub const TfLiteAllocationStrategy_kTfLiteAllocationStrategyNew: TfLiteAllocationStrategy = 5;
591#[doc = " Memory allocation strategies.\n\n TfLiteAllocationType values have been overloaded to mean more than their\n original intent. This enum should only be used to document the allocation\n strategy used by a tensor for it data."]
592pub type TfLiteAllocationStrategy = ::std::os::raw::c_uint;
593pub const TfLiteRunStability_kTfLiteRunStabilityUnknown: TfLiteRunStability = 0;
594pub const TfLiteRunStability_kTfLiteRunStabilityUnstable: TfLiteRunStability = 1;
595#[doc = " May change at any time."]
596pub const TfLiteRunStability_kTfLiteRunStabilitySingleRun: TfLiteRunStability = 2;
597#[doc = " Will stay the same for one run."]
598pub const TfLiteRunStability_kTfLiteRunStabilityAcrossRuns: TfLiteRunStability = 3;
599#[doc = " Describes how stable a tensor attribute is with regards to an interpreter\n runs."]
600pub type TfLiteRunStability = ::std::os::raw::c_uint;
601pub const TfLiteRunStep_kTfLiteRunStepUnknown: TfLiteRunStep = 0;
602pub const TfLiteRunStep_kTfLiteRunStepInit: TfLiteRunStep = 1;
603pub const TfLiteRunStep_kTfLiteRunStepPrepare: TfLiteRunStep = 2;
604pub const TfLiteRunStep_kTfLiteRunStepEval: TfLiteRunStep = 3;
605#[doc = " Describes the steps of a TFLite operation life cycle."]
606pub type TfLiteRunStep = ::std::os::raw::c_uint;
607#[doc = " The delegates should use zero or positive integers to represent handles.\n -1 is reserved from unallocated status."]
608pub type TfLiteBufferHandle = ::std::os::raw::c_int;
609#[doc = " Metadata to encode each dimension in a sparse tensor."]
610#[repr(C)]
611#[derive(Debug, Copy, Clone)]
612pub struct TfLiteDimensionMetadata {
613 pub format: TfLiteDimensionType,
614 pub dense_size: ::std::os::raw::c_int,
615 pub array_segments: *mut TfLiteIntArray,
616 pub array_indices: *mut TfLiteIntArray,
617}
618#[allow(clippy::unnecessary_operation, clippy::identity_op)]
619const _: () = {
620 ["Size of TfLiteDimensionMetadata"][::std::mem::size_of::<TfLiteDimensionMetadata>() - 24usize];
621 ["Alignment of TfLiteDimensionMetadata"]
622 [::std::mem::align_of::<TfLiteDimensionMetadata>() - 8usize];
623 ["Offset of field: TfLiteDimensionMetadata::format"]
624 [::std::mem::offset_of!(TfLiteDimensionMetadata, format) - 0usize];
625 ["Offset of field: TfLiteDimensionMetadata::dense_size"]
626 [::std::mem::offset_of!(TfLiteDimensionMetadata, dense_size) - 4usize];
627 ["Offset of field: TfLiteDimensionMetadata::array_segments"]
628 [::std::mem::offset_of!(TfLiteDimensionMetadata, array_segments) - 8usize];
629 ["Offset of field: TfLiteDimensionMetadata::array_indices"]
630 [::std::mem::offset_of!(TfLiteDimensionMetadata, array_indices) - 16usize];
631};
632#[doc = " Parameters used to encode a sparse tensor. For detailed explanation of each\n field please refer to lite/schema/schema.fbs."]
633#[repr(C)]
634#[derive(Debug, Copy, Clone)]
635pub struct TfLiteSparsity {
636 pub traversal_order: *mut TfLiteIntArray,
637 pub block_map: *mut TfLiteIntArray,
638 pub dim_metadata: *mut TfLiteDimensionMetadata,
639 pub dim_metadata_size: ::std::os::raw::c_int,
640}
641#[allow(clippy::unnecessary_operation, clippy::identity_op)]
642const _: () = {
643 ["Size of TfLiteSparsity"][::std::mem::size_of::<TfLiteSparsity>() - 32usize];
644 ["Alignment of TfLiteSparsity"][::std::mem::align_of::<TfLiteSparsity>() - 8usize];
645 ["Offset of field: TfLiteSparsity::traversal_order"]
646 [::std::mem::offset_of!(TfLiteSparsity, traversal_order) - 0usize];
647 ["Offset of field: TfLiteSparsity::block_map"]
648 [::std::mem::offset_of!(TfLiteSparsity, block_map) - 8usize];
649 ["Offset of field: TfLiteSparsity::dim_metadata"]
650 [::std::mem::offset_of!(TfLiteSparsity, dim_metadata) - 16usize];
651 ["Offset of field: TfLiteSparsity::dim_metadata_size"]
652 [::std::mem::offset_of!(TfLiteSparsity, dim_metadata_size) - 24usize];
653};
654#[repr(C)]
655#[derive(Copy, Clone)]
656pub struct TfLiteTensor {
657 #[doc = " The data type specification for data stored in `data`. This affects\n what member of `data` union should be used."]
658 pub type_: TfLiteType,
659 #[doc = " A union of data pointers. The appropriate type should be used for a typed\n tensor based on `type`."]
660 pub data: TfLitePtrUnion,
661 #[doc = " A pointer to a structure representing the dimensionality interpretation\n that the buffer should have. NOTE: the product of elements of `dims`\n and the element datatype size should be equal to `bytes` below."]
662 pub dims: *mut TfLiteIntArray,
663 #[doc = " Quantization information."]
664 pub params: TfLiteQuantizationParams,
665 #[doc = " How memory is mapped\n kTfLiteMmapRo: Memory mapped read only.\n i.e. weights\n kTfLiteArenaRw: Arena allocated read write memory\n (i.e. temporaries, outputs)."]
666 pub allocation_type: TfLiteAllocationType,
667 #[doc = " The number of bytes required to store the data of this Tensor. I.e.\n (bytes of each element) * dims[0] * ... * dims[n-1]. For example, if\n type is kTfLiteFloat32 and dims = {3, 2} then\n bytes = sizeof(float) * 3 * 2 = 4 * 3 * 2 = 24."]
668 pub bytes: usize,
669 #[doc = " An opaque pointer to a tflite::MMapAllocation"]
670 pub allocation: *const ::std::os::raw::c_void,
671 #[doc = " Null-terminated name of this tensor."]
672 pub name: *const ::std::os::raw::c_char,
673 #[doc = " The delegate which knows how to handle `buffer_handle`.\n\n WARNING: This is an experimental interface that is subject to change."]
674 pub delegate: *mut TfLiteDelegate,
675 #[doc = " An integer buffer handle that can be handled by `delegate`.\n The value is valid only when delegate is not null.\n\n WARNING: This is an experimental interface that is subject to change."]
676 pub buffer_handle: TfLiteBufferHandle,
677 #[doc = " If the delegate uses its own buffer (e.g. GPU memory), the delegate is\n responsible to set data_is_stale to true.\n `delegate->CopyFromBufferHandle` can be called to copy the data from\n delegate buffer.\n\n WARNING: This is an experimental interface that is subject to change."]
678 pub data_is_stale: bool,
679 #[doc = " True if the tensor is a variable."]
680 pub is_variable: bool,
681 #[doc = " Quantization information. Replaces params field above."]
682 pub quantization: TfLiteQuantization,
683 #[doc = " Parameters used to encode a sparse tensor.\n This is optional. The field is NULL if a tensor is dense.\n\n WARNING: This is an experimental interface that is subject to change."]
684 pub sparsity: *mut TfLiteSparsity,
685 #[doc = " Optional. Encodes shapes with unknown dimensions with -1. This field is\n only populated when unknown dimensions exist in a read-write tensor (i.e.\n an input or output tensor). (e.g. `dims` contains [1, 1, 1, 3] and\n `dims_signature` contains [1, -1, -1, 3]). If no unknown dimensions exist\n then `dims_signature` is either null, or set to an empty array. Note that\n this field only exists when TF_LITE_STATIC_MEMORY is not defined."]
686 pub dims_signature: *const TfLiteIntArray,
687}
688#[allow(clippy::unnecessary_operation, clippy::identity_op)]
689const _: () = {
690 ["Size of TfLiteTensor"][::std::mem::size_of::<TfLiteTensor>() - 112usize];
691 ["Alignment of TfLiteTensor"][::std::mem::align_of::<TfLiteTensor>() - 8usize];
692 ["Offset of field: TfLiteTensor::type_"][::std::mem::offset_of!(TfLiteTensor, type_) - 0usize];
693 ["Offset of field: TfLiteTensor::data"][::std::mem::offset_of!(TfLiteTensor, data) - 8usize];
694 ["Offset of field: TfLiteTensor::dims"][::std::mem::offset_of!(TfLiteTensor, dims) - 16usize];
695 ["Offset of field: TfLiteTensor::params"]
696 [::std::mem::offset_of!(TfLiteTensor, params) - 24usize];
697 ["Offset of field: TfLiteTensor::allocation_type"]
698 [::std::mem::offset_of!(TfLiteTensor, allocation_type) - 32usize];
699 ["Offset of field: TfLiteTensor::bytes"][::std::mem::offset_of!(TfLiteTensor, bytes) - 40usize];
700 ["Offset of field: TfLiteTensor::allocation"]
701 [::std::mem::offset_of!(TfLiteTensor, allocation) - 48usize];
702 ["Offset of field: TfLiteTensor::name"][::std::mem::offset_of!(TfLiteTensor, name) - 56usize];
703 ["Offset of field: TfLiteTensor::delegate"]
704 [::std::mem::offset_of!(TfLiteTensor, delegate) - 64usize];
705 ["Offset of field: TfLiteTensor::buffer_handle"]
706 [::std::mem::offset_of!(TfLiteTensor, buffer_handle) - 72usize];
707 ["Offset of field: TfLiteTensor::data_is_stale"]
708 [::std::mem::offset_of!(TfLiteTensor, data_is_stale) - 76usize];
709 ["Offset of field: TfLiteTensor::is_variable"]
710 [::std::mem::offset_of!(TfLiteTensor, is_variable) - 77usize];
711 ["Offset of field: TfLiteTensor::quantization"]
712 [::std::mem::offset_of!(TfLiteTensor, quantization) - 80usize];
713 ["Offset of field: TfLiteTensor::sparsity"]
714 [::std::mem::offset_of!(TfLiteTensor, sparsity) - 96usize];
715 ["Offset of field: TfLiteTensor::dims_signature"]
716 [::std::mem::offset_of!(TfLiteTensor, dims_signature) - 104usize];
717};
718#[doc = " A structure representing an instance of a node.\n This structure only exhibits the inputs, outputs, user defined data and some\n node properties (like statefulness), not other features like the type."]
719#[repr(C)]
720#[derive(Debug, Copy, Clone)]
721pub struct TfLiteNode {
722 #[doc = " Inputs to this node expressed as indices into the simulator's tensors."]
723 pub inputs: *mut TfLiteIntArray,
724 #[doc = " Outputs to this node expressed as indices into the simulator's tensors."]
725 pub outputs: *mut TfLiteIntArray,
726 #[doc = " intermediate tensors to this node expressed as indices into the\n simulator's tensors."]
727 pub intermediates: *mut TfLiteIntArray,
728 #[doc = " Temporary tensors uses during the computations. This usually contains no\n tensors, but ops are allowed to change that if they need scratch space of\n any sort."]
729 pub temporaries: *mut TfLiteIntArray,
730 #[doc = " Opaque data provided by the node implementer through `Registration.init`."]
731 pub user_data: *mut ::std::os::raw::c_void,
732 #[doc = " Opaque data provided to the node if the node is a builtin. This is usually\n a structure defined in builtin_op_data.h"]
733 pub builtin_data: *mut ::std::os::raw::c_void,
734 #[doc = " Custom initial data. This is the opaque data provided in the flatbuffer.\n\n WARNING: This is an experimental interface that is subject to change."]
735 pub custom_initial_data: *const ::std::os::raw::c_void,
736 pub custom_initial_data_size: ::std::os::raw::c_int,
737 #[doc = " The pointer to the delegate. This is non-null only when the node is\n created by calling `interpreter.ModifyGraphWithDelegate`.\n\n WARNING: This is an experimental interface that is subject to change."]
738 pub delegate: *mut TfLiteDelegate,
739 #[doc = " Whether this op might have side effect (e.g. stateful op)."]
740 pub might_have_side_effect: bool,
741}
742#[allow(clippy::unnecessary_operation, clippy::identity_op)]
743const _: () = {
744 ["Size of TfLiteNode"][::std::mem::size_of::<TfLiteNode>() - 80usize];
745 ["Alignment of TfLiteNode"][::std::mem::align_of::<TfLiteNode>() - 8usize];
746 ["Offset of field: TfLiteNode::inputs"][::std::mem::offset_of!(TfLiteNode, inputs) - 0usize];
747 ["Offset of field: TfLiteNode::outputs"][::std::mem::offset_of!(TfLiteNode, outputs) - 8usize];
748 ["Offset of field: TfLiteNode::intermediates"]
749 [::std::mem::offset_of!(TfLiteNode, intermediates) - 16usize];
750 ["Offset of field: TfLiteNode::temporaries"]
751 [::std::mem::offset_of!(TfLiteNode, temporaries) - 24usize];
752 ["Offset of field: TfLiteNode::user_data"]
753 [::std::mem::offset_of!(TfLiteNode, user_data) - 32usize];
754 ["Offset of field: TfLiteNode::builtin_data"]
755 [::std::mem::offset_of!(TfLiteNode, builtin_data) - 40usize];
756 ["Offset of field: TfLiteNode::custom_initial_data"]
757 [::std::mem::offset_of!(TfLiteNode, custom_initial_data) - 48usize];
758 ["Offset of field: TfLiteNode::custom_initial_data_size"]
759 [::std::mem::offset_of!(TfLiteNode, custom_initial_data_size) - 56usize];
760 ["Offset of field: TfLiteNode::delegate"]
761 [::std::mem::offset_of!(TfLiteNode, delegate) - 64usize];
762 ["Offset of field: TfLiteNode::might_have_side_effect"]
763 [::std::mem::offset_of!(TfLiteNode, might_have_side_effect) - 72usize];
764};
765#[doc = " Light-weight tensor struct for TF Micro runtime. Provides the minimal amount\n of information required for a kernel to run during TfLiteRegistration::Eval."]
766#[repr(C)]
767#[derive(Copy, Clone)]
768pub struct TfLiteEvalTensor {
769 #[doc = " A union of data pointers. The appropriate type should be used for a typed\n tensor based on `type`."]
770 pub data: TfLitePtrUnion,
771 #[doc = " A pointer to a structure representing the dimensionality interpretation\n that the buffer should have."]
772 pub dims: *mut TfLiteIntArray,
773 #[doc = " The data type specification for data stored in `data`. This affects\n what member of `data` union should be used."]
774 pub type_: TfLiteType,
775}
776#[allow(clippy::unnecessary_operation, clippy::identity_op)]
777const _: () = {
778 ["Size of TfLiteEvalTensor"][::std::mem::size_of::<TfLiteEvalTensor>() - 24usize];
779 ["Alignment of TfLiteEvalTensor"][::std::mem::align_of::<TfLiteEvalTensor>() - 8usize];
780 ["Offset of field: TfLiteEvalTensor::data"]
781 [::std::mem::offset_of!(TfLiteEvalTensor, data) - 0usize];
782 ["Offset of field: TfLiteEvalTensor::dims"]
783 [::std::mem::offset_of!(TfLiteEvalTensor, dims) - 8usize];
784 ["Offset of field: TfLiteEvalTensor::type_"]
785 [::std::mem::offset_of!(TfLiteEvalTensor, type_) - 16usize];
786};
787#[doc = " WARNING: This is an experimental interface that is subject to change.\n\n Currently, TfLiteDelegateParams has to be allocated in a way that it's\n trivially destructable. It will be stored as `builtin_data` field in\n `TfLiteNode` of the delegate node.\n\n See also the `CreateDelegateParams` function in `interpreter.cc` details."]
788#[repr(C)]
789#[derive(Debug, Copy, Clone)]
790pub struct TfLiteDelegateParams {
791 pub delegate: *mut TfLiteDelegate,
792 pub nodes_to_replace: *mut TfLiteIntArray,
793 pub input_tensors: *mut TfLiteIntArray,
794 pub output_tensors: *mut TfLiteIntArray,
795}
796#[allow(clippy::unnecessary_operation, clippy::identity_op)]
797const _: () = {
798 ["Size of TfLiteDelegateParams"][::std::mem::size_of::<TfLiteDelegateParams>() - 32usize];
799 ["Alignment of TfLiteDelegateParams"][::std::mem::align_of::<TfLiteDelegateParams>() - 8usize];
800 ["Offset of field: TfLiteDelegateParams::delegate"]
801 [::std::mem::offset_of!(TfLiteDelegateParams, delegate) - 0usize];
802 ["Offset of field: TfLiteDelegateParams::nodes_to_replace"]
803 [::std::mem::offset_of!(TfLiteDelegateParams, nodes_to_replace) - 8usize];
804 ["Offset of field: TfLiteDelegateParams::input_tensors"]
805 [::std::mem::offset_of!(TfLiteDelegateParams, input_tensors) - 16usize];
806 ["Offset of field: TfLiteDelegateParams::output_tensors"]
807 [::std::mem::offset_of!(TfLiteDelegateParams, output_tensors) - 24usize];
808};
809#[doc = " `TfLiteContext` allows an op to access the tensors.\n\n `TfLiteContext` is a struct that is created by the TF Lite runtime\n and passed to the \"methods\" (C function pointers) in the\n `TfLiteRegistration` struct that are used to define custom ops and custom\n delegate kernels. It contains information and methods (C function pointers)\n that can be called by the code implementing a custom op or a custom delegate\n kernel. These methods provide access to the context in which that custom op\n or custom delegate kernel occurs, such as access to the input and output\n tensors for that op, as well as methods for allocating memory buffers\n and intermediate tensors, etc.\n\n See also `TfLiteOpaqueContext`, which is an more ABI-stable equivalent."]
810#[repr(C)]
811#[derive(Debug, Copy, Clone)]
812pub struct TfLiteContext {
813 #[doc = " Number of tensors in the context."]
814 pub tensors_size: usize,
815 #[doc = " The execution plan contains a list of the node indices in execution\n order. execution_plan->size is the current number of nodes. And,\n execution_plan->data[0] is the first node that needs to be run.\n TfLiteDelegates can traverse the current execution plan by iterating\n through each member of this array and using GetNodeAndRegistration() to\n access details about a node. i.e.\n\n```text\n TfLiteIntArray* execution_plan;\n TF_LITE_ENSURE_STATUS(context->GetExecutionPlan(context,\n &execution_plan));\n for (int exec_index = 0; exec_index < execution_plan->size;\n exec_index++) {\n int node_index = execution_plan->data[exec_index];\n TfLiteNode* node;\n TfLiteRegistration* reg;\n context->GetNodeAndRegistration(context, node_index, &node, ®);\n }\n```\n\n Note: the memory pointed by '`*execution_plan` is OWNED by TfLite runtime.\n Future calls to GetExecutionPlan invalidates earlier outputs. The\n following code snippet shows the issue of such an invocation pattern.\n After calling CheckNode, subsequent access to `plan_1st` is undefined.\n\n```text\n void CheckNode(const TfLiteNode* node) {\n ...\n TfLiteIntArray* plan_2nd;\n TF_LITE_ENSURE_STATUS(\n context->GetExecutionPlan(context, &plan_2nd)\n );\n ...\n }\n\n TfLiteIntArray* plan_1st;\n TF_LITE_ENSURE_STATUS(context->GetExecutionPlan(context, &plan_1st));\n for (int exec_index = 0; exec_index < plan_1st->size; exec_index++) {\n int node_index = plan_1st->data[exec_index];\n TfLiteNode* node;\n TfLiteRegistration* reg;\n context->GetNodeAndRegistration(context, node_index, &node, ®);\n CheckNode(node);\n }\n```\n\n WARNING: This is an experimental interface that is subject to change."]
816 pub GetExecutionPlan: ::std::option::Option<
817 unsafe extern "C" fn(
818 context: *mut TfLiteContext,
819 execution_plan: *mut *mut TfLiteIntArray,
820 ) -> TfLiteStatus,
821 >,
822 #[doc = " An array of tensors in the interpreter context (of length `tensors_size`)"]
823 pub tensors: *mut TfLiteTensor,
824 #[doc = " opaque full context ptr (an opaque c++ data structure)"]
825 pub impl_: *mut ::std::os::raw::c_void,
826 #[doc = " Request memory pointer be resized. Updates dimensions on the tensor.\n NOTE: ResizeTensor takes ownership of newSize."]
827 pub ResizeTensor: ::std::option::Option<
828 unsafe extern "C" fn(
829 arg1: *mut TfLiteContext,
830 tensor: *mut TfLiteTensor,
831 new_size: *mut TfLiteIntArray,
832 ) -> TfLiteStatus,
833 >,
834 #[doc = " Request that an error be reported with format string msg."]
835 pub ReportError: ::std::option::Option<
836 unsafe extern "C" fn(arg1: *mut TfLiteContext, msg: *const ::std::os::raw::c_char, ...),
837 >,
838 #[doc = " Add `tensors_to_add` tensors, preserving pre-existing Tensor entries. If\n non-null, the value pointed to by `first_new_tensor_index` will be set to\n the index of the first new tensor."]
839 pub AddTensors: ::std::option::Option<
840 unsafe extern "C" fn(
841 arg1: *mut TfLiteContext,
842 tensors_to_add: ::std::os::raw::c_int,
843 first_new_tensor_index: *mut ::std::os::raw::c_int,
844 ) -> TfLiteStatus,
845 >,
846 #[doc = " Get a Tensor node by node_index.\n\n WARNING: This is an experimental interface that is subject to change."]
847 pub GetNodeAndRegistration: ::std::option::Option<
848 unsafe extern "C" fn(
849 arg1: *mut TfLiteContext,
850 node_index: ::std::os::raw::c_int,
851 node: *mut *mut TfLiteNode,
852 registration: *mut *mut TfLiteRegistration,
853 ) -> TfLiteStatus,
854 >,
855 #[doc = " Replace ops with one or more stub delegate operations. This function\n does not take ownership of `nodes_to_replace`."]
856 pub ReplaceNodeSubsetsWithDelegateKernels: ::std::option::Option<
857 unsafe extern "C" fn(
858 arg1: *mut TfLiteContext,
859 registration: TfLiteRegistration,
860 nodes_to_replace: *const TfLiteIntArray,
861 delegate: *mut TfLiteDelegate,
862 ) -> TfLiteStatus,
863 >,
864 #[doc = " Number of threads that are recommended to subsystems like gemmlowp and\n eigen."]
865 pub recommended_num_threads: ::std::os::raw::c_int,
866 #[doc = " Access external contexts by type.\n\n WARNING: This is an experimental interface that is subject to change."]
867 pub GetExternalContext: ::std::option::Option<
868 unsafe extern "C" fn(
869 arg1: *mut TfLiteContext,
870 arg2: TfLiteExternalContextType,
871 ) -> *mut TfLiteExternalContext,
872 >,
873 #[doc = " Set the value of a external context. Does not take ownership of the\n pointer.\n\n WARNING: This is an experimental interface that is subject to change."]
874 pub SetExternalContext: ::std::option::Option<
875 unsafe extern "C" fn(
876 arg1: *mut TfLiteContext,
877 arg2: TfLiteExternalContextType,
878 arg3: *mut TfLiteExternalContext,
879 ),
880 >,
881 #[doc = " Flag for allowing float16 precision for FP32 calculation.\n default: false.\n\n WARNING: This is an experimental API and subject to change."]
882 pub allow_fp32_relax_to_fp16: bool,
883 #[doc = " Pointer to the op-level profiler, if set; nullptr otherwise."]
884 pub profiler: *mut ::std::os::raw::c_void,
885 #[doc = " Allocate persistent buffer which has the same life time as the\n interpreter. Returns `nullptr` on failure. The memory is allocated from\n heap for TFL, and from tail in TFLM. This method is only available in\n `Init` or `Prepare` stage.\n\n WARNING: This is an experimental interface that is subject\n to change."]
886 pub AllocatePersistentBuffer: ::std::option::Option<
887 unsafe extern "C" fn(ctx: *mut TfLiteContext, bytes: usize) -> *mut ::std::os::raw::c_void,
888 >,
889 #[doc = " Allocate a buffer which will be deallocated right after invoke phase.\n The memory is allocated from heap in TFL, and from volatile arena in TFLM.\n This method is only available in invoke stage.\n\n NOTE: If possible use `RequestScratchBufferInArena` method to avoid memory\n allocation during inference time.\n\n WARNING: This is an experimental interface that is subject to change."]
890 pub AllocateBufferForEval: ::std::option::Option<
891 unsafe extern "C" fn(
892 ctx: *mut TfLiteContext,
893 bytes: usize,
894 ptr: *mut *mut ::std::os::raw::c_void,
895 ) -> TfLiteStatus,
896 >,
897 #[doc = " Request a scratch buffer in the arena through static memory planning.\n This method is only available in `Prepare` stage and the buffer is\n allocated by the interpreter between Prepare and Eval stage. In `Eval`\n stage, `GetScratchBuffer` API can be used to fetch the address.\n\n WARNING: This is an experimental interface that is subject to change."]
898 pub RequestScratchBufferInArena: ::std::option::Option<
899 unsafe extern "C" fn(
900 ctx: *mut TfLiteContext,
901 bytes: usize,
902 buffer_idx: *mut ::std::os::raw::c_int,
903 ) -> TfLiteStatus,
904 >,
905 #[doc = " Get the scratch buffer pointer.\n This method is only available in Eval stage.\n\n WARNING: This is an experimental interface that is subject to change."]
906 pub GetScratchBuffer: ::std::option::Option<
907 unsafe extern "C" fn(
908 ctx: *mut TfLiteContext,
909 buffer_idx: ::std::os::raw::c_int,
910 ) -> *mut ::std::os::raw::c_void,
911 >,
912 #[doc = " Resize the memory pointer of the `tensor`. This method behaves the same as\n `ResizeTensor`, except that it makes a copy of the shape array internally\n so the shape array could be deallocated right afterwards.\n\n WARNING: This is an experimental interface that is subject to change."]
913 pub ResizeTensorExplicit: ::std::option::Option<
914 unsafe extern "C" fn(
915 ctx: *mut TfLiteContext,
916 tensor: *mut TfLiteTensor,
917 dims: ::std::os::raw::c_int,
918 shape: *const ::std::os::raw::c_int,
919 ) -> TfLiteStatus,
920 >,
921 #[doc = " This method provides a preview of post-delegation partitioning. Each\n TfLiteDelegateParams in the referenced array corresponds to one instance\n of the delegate kernel. Example usage:\n\n```text\n TfLiteIntArray* nodes_to_replace = ...;\n TfLiteDelegateParams* params_array;\n int num_partitions = 0;\n TF_LITE_ENSURE_STATUS(context->PreviewDelegatePartitioning(\n context, delegate, nodes_to_replace, ¶ms_array,\n &num_partitions));\n for (int idx = 0; idx < num_partitions; idx++) {\n const auto& partition_params = params_array[idx];\n ...\n }\n```\n\n NOTE: The context owns the memory referenced by partition_params_array. It\n will be cleared with another call to PreviewDelegatePartitioning, or after\n TfLiteDelegateParams::Prepare returns.\n\n WARNING: This is an experimental interface that is subject to change."]
922 pub PreviewDelegatePartitioning: ::std::option::Option<
923 unsafe extern "C" fn(
924 context: *mut TfLiteContext,
925 nodes_to_replace: *const TfLiteIntArray,
926 partition_params_array: *mut *mut TfLiteDelegateParams,
927 num_partitions: *mut ::std::os::raw::c_int,
928 ) -> TfLiteStatus,
929 >,
930 #[doc = " Returns a TfLiteTensor struct for a given index.\n\n WARNING: This is an experimental interface that is subject to change.\n\n WARNING: This method may not be available on all platforms."]
931 pub GetTensor: ::std::option::Option<
932 unsafe extern "C" fn(
933 context: *const TfLiteContext,
934 tensor_idx: ::std::os::raw::c_int,
935 ) -> *mut TfLiteTensor,
936 >,
937 #[doc = " Returns a TfLiteEvalTensor struct for a given index.\n\n WARNING: This is an experimental interface that is subject to change.\n\n WARNING: This method may not be available on all platforms."]
938 pub GetEvalTensor: ::std::option::Option<
939 unsafe extern "C" fn(
940 context: *const TfLiteContext,
941 tensor_idx: ::std::os::raw::c_int,
942 ) -> *mut TfLiteEvalTensor,
943 >,
944 #[doc = " Retrieves named metadata buffer from the TFLite model.\n Returns kTfLiteOk if metadata is successfully obtained from the flatbuffer\n Model: that is, there exists a `metadata` entry with given `name` string.\n (see TFLite's schema.fbs).\n The corresponding `buffer` information is populated in `ptr` & `bytes`.\n The data from `ptr` is valid for the lifetime of the Interpreter.\n\n WARNING: This is an experimental interface that is subject to change."]
945 pub GetModelMetadata: ::std::option::Option<
946 unsafe extern "C" fn(
947 context: *const TfLiteContext,
948 name: *const ::std::os::raw::c_char,
949 ptr: *mut *const ::std::os::raw::c_char,
950 bytes: *mut usize,
951 ) -> TfLiteStatus,
952 >,
953 #[doc = " Retrieves the corresponding TfLiteContext of a subgraph that the given\n subgraph_index points to and switches to the delegate context for that\n subgraph. If an invalid subgraph index is given, returns kTfLiteError.\n\n NOTE: This function is expected to be paired with ReleaseSubgraphContext()\n once the delegate preparation is done and/or the delegate context\n functions are no longer needed.\n\n WARNING: This is an experimental interface that is subject to change."]
954 pub AcquireSubgraphContext: ::std::option::Option<
955 unsafe extern "C" fn(
956 context: *mut TfLiteContext,
957 subgraph_index: ::std::os::raw::c_int,
958 acquired_context: *mut *mut TfLiteContext,
959 ) -> TfLiteStatus,
960 >,
961 #[doc = " Releases the subgraph context by switching back to the TFLite kernel\n context for the subgraph that the given subgraph_index points to.\n\n NOTE: This function is expected to be used after AcquireSubgraphContext()\n once the delegate preparation is done and/or the delegate context\n functions are no longer needed.\n\n WARNING: This is an experimental interface that is subject to change."]
962 pub ReleaseSubgraphContext: ::std::option::Option<
963 unsafe extern "C" fn(
964 context: *mut TfLiteContext,
965 subgraph_index: ::std::os::raw::c_int,
966 ) -> TfLiteStatus,
967 >,
968}
969#[allow(clippy::unnecessary_operation, clippy::identity_op)]
970const _: () = {
971 ["Size of TfLiteContext"][::std::mem::size_of::<TfLiteContext>() - 200usize];
972 ["Alignment of TfLiteContext"][::std::mem::align_of::<TfLiteContext>() - 8usize];
973 ["Offset of field: TfLiteContext::tensors_size"]
974 [::std::mem::offset_of!(TfLiteContext, tensors_size) - 0usize];
975 ["Offset of field: TfLiteContext::GetExecutionPlan"]
976 [::std::mem::offset_of!(TfLiteContext, GetExecutionPlan) - 8usize];
977 ["Offset of field: TfLiteContext::tensors"]
978 [::std::mem::offset_of!(TfLiteContext, tensors) - 16usize];
979 ["Offset of field: TfLiteContext::impl_"]
980 [::std::mem::offset_of!(TfLiteContext, impl_) - 24usize];
981 ["Offset of field: TfLiteContext::ResizeTensor"]
982 [::std::mem::offset_of!(TfLiteContext, ResizeTensor) - 32usize];
983 ["Offset of field: TfLiteContext::ReportError"]
984 [::std::mem::offset_of!(TfLiteContext, ReportError) - 40usize];
985 ["Offset of field: TfLiteContext::AddTensors"]
986 [::std::mem::offset_of!(TfLiteContext, AddTensors) - 48usize];
987 ["Offset of field: TfLiteContext::GetNodeAndRegistration"]
988 [::std::mem::offset_of!(TfLiteContext, GetNodeAndRegistration) - 56usize];
989 ["Offset of field: TfLiteContext::ReplaceNodeSubsetsWithDelegateKernels"]
990 [::std::mem::offset_of!(TfLiteContext, ReplaceNodeSubsetsWithDelegateKernels) - 64usize];
991 ["Offset of field: TfLiteContext::recommended_num_threads"]
992 [::std::mem::offset_of!(TfLiteContext, recommended_num_threads) - 72usize];
993 ["Offset of field: TfLiteContext::GetExternalContext"]
994 [::std::mem::offset_of!(TfLiteContext, GetExternalContext) - 80usize];
995 ["Offset of field: TfLiteContext::SetExternalContext"]
996 [::std::mem::offset_of!(TfLiteContext, SetExternalContext) - 88usize];
997 ["Offset of field: TfLiteContext::allow_fp32_relax_to_fp16"]
998 [::std::mem::offset_of!(TfLiteContext, allow_fp32_relax_to_fp16) - 96usize];
999 ["Offset of field: TfLiteContext::profiler"]
1000 [::std::mem::offset_of!(TfLiteContext, profiler) - 104usize];
1001 ["Offset of field: TfLiteContext::AllocatePersistentBuffer"]
1002 [::std::mem::offset_of!(TfLiteContext, AllocatePersistentBuffer) - 112usize];
1003 ["Offset of field: TfLiteContext::AllocateBufferForEval"]
1004 [::std::mem::offset_of!(TfLiteContext, AllocateBufferForEval) - 120usize];
1005 ["Offset of field: TfLiteContext::RequestScratchBufferInArena"]
1006 [::std::mem::offset_of!(TfLiteContext, RequestScratchBufferInArena) - 128usize];
1007 ["Offset of field: TfLiteContext::GetScratchBuffer"]
1008 [::std::mem::offset_of!(TfLiteContext, GetScratchBuffer) - 136usize];
1009 ["Offset of field: TfLiteContext::ResizeTensorExplicit"]
1010 [::std::mem::offset_of!(TfLiteContext, ResizeTensorExplicit) - 144usize];
1011 ["Offset of field: TfLiteContext::PreviewDelegatePartitioning"]
1012 [::std::mem::offset_of!(TfLiteContext, PreviewDelegatePartitioning) - 152usize];
1013 ["Offset of field: TfLiteContext::GetTensor"]
1014 [::std::mem::offset_of!(TfLiteContext, GetTensor) - 160usize];
1015 ["Offset of field: TfLiteContext::GetEvalTensor"]
1016 [::std::mem::offset_of!(TfLiteContext, GetEvalTensor) - 168usize];
1017 ["Offset of field: TfLiteContext::GetModelMetadata"]
1018 [::std::mem::offset_of!(TfLiteContext, GetModelMetadata) - 176usize];
1019 ["Offset of field: TfLiteContext::AcquireSubgraphContext"]
1020 [::std::mem::offset_of!(TfLiteContext, AcquireSubgraphContext) - 184usize];
1021 ["Offset of field: TfLiteContext::ReleaseSubgraphContext"]
1022 [::std::mem::offset_of!(TfLiteContext, ReleaseSubgraphContext) - 192usize];
1023};
1024#[doc = " `TfLiteRegistration` defines the implementation of an operation\n (a built-in op, custom op, or custom delegate kernel).\n\n It is a struct containing \"methods\" (C function pointers) that will be\n invoked by the TF Lite runtime to evaluate instances of the operation.\n\n See also `TfLiteOperator` which is a more ABI-stable equivalent."]
1025#[repr(C)]
1026#[derive(Debug, Copy, Clone)]
1027pub struct TfLiteRegistration {
1028 #[doc = " Initializes the op from serialized data.\n Called only *once* for the lifetime of the op, so any one-time allocations\n should be made here (unless they depend on tensor sizes).\n\n * If a built-in op:\n * `buffer` is the op's params data (TfLiteLSTMParams*).\n * `length` is zero.\n * If custom op:\n * `buffer` is the op's `custom_options`.\n * `length` is the size of the buffer.\n\n Returns a type-punned (i.e. void*) opaque data (e.g. a primitive pointer\n or an instance of a struct).\n\n The returned pointer will be stored with the node in the `user_data`\n field, accessible within prepare and invoke functions below.\n\n NOTE: if the data is already in the desired format, simply implement this\n function to return `nullptr` and implement the free function to be a\n no-op."]
1029 pub init: ::std::option::Option<
1030 unsafe extern "C" fn(
1031 context: *mut TfLiteContext,
1032 buffer: *const ::std::os::raw::c_char,
1033 length: usize,
1034 ) -> *mut ::std::os::raw::c_void,
1035 >,
1036 #[doc = " The pointer `buffer` is the data previously returned by an init\n invocation."]
1037 pub free: ::std::option::Option<
1038 unsafe extern "C" fn(context: *mut TfLiteContext, buffer: *mut ::std::os::raw::c_void),
1039 >,
1040 #[doc = " prepare is called when the inputs this node depends on have been resized.\n `context->ResizeTensor()` can be called to request output tensors to be\n resized.\n Can be called multiple times for the lifetime of the op.\n\n Returns `kTfLiteOk` on success."]
1041 pub prepare: ::std::option::Option<
1042 unsafe extern "C" fn(context: *mut TfLiteContext, node: *mut TfLiteNode) -> TfLiteStatus,
1043 >,
1044 #[doc = " Execute the node (should read `node->inputs` and output to\n `node->outputs`).\n\n Returns `kTfLiteOk` on success."]
1045 pub invoke: ::std::option::Option<
1046 unsafe extern "C" fn(context: *mut TfLiteContext, node: *mut TfLiteNode) -> TfLiteStatus,
1047 >,
1048 #[doc = " `profiling_string` is called during summarization of profiling information\n in order to group executions together. Providing a value here will cause a\n given op to appear multiple times is the profiling report. This is\n particularly useful for custom ops that can perform significantly\n different calculations depending on their `user-data`."]
1049 pub profiling_string: ::std::option::Option<
1050 unsafe extern "C" fn(
1051 context: *const TfLiteContext,
1052 node: *const TfLiteNode,
1053 ) -> *const ::std::os::raw::c_char,
1054 >,
1055 #[doc = " Builtin codes. If this kernel refers to a builtin this is the code\n of the builtin. This is so we can do marshaling to other frameworks like\n NN API.\n\n Note: It is the responsibility of the registration binder to set this\n properly."]
1056 pub builtin_code: i32,
1057 #[doc = " Custom op name. If the op is a builtin, this will be `null`.\n\n Note: It is the responsibility of the registration binder to set this\n properly.\n\n WARNING: This is an experimental interface that is subject to change."]
1058 pub custom_name: *const ::std::os::raw::c_char,
1059 #[doc = " The version of the op.\n Note: It is the responsibility of the registration binder to set this\n properly."]
1060 pub version: ::std::os::raw::c_int,
1061 #[doc = " The external (i.e. ABI-stable) version of `TfLiteRegistration`.\n Since we can't use internal types (such as `TfLiteContext`) for C API to\n maintain ABI stability. C API user will provide `TfLiteOperator` to\n implement custom ops. We keep it inside of `TfLiteRegistration` and use\n it to route callbacks properly."]
1062 pub registration_external: *mut TfLiteOperator,
1063 #[doc = " Retrieves asynchronous kernel.\n\n If the `async_kernel` field is nullptr, it means the operation described\n by this TfLiteRegistration object does not support asynchronous execution.\n Otherwise, the function that the field points to should only be called for\n delegate kernel nodes, i.e. `node` should be a delegate kernel node\n created by applying a delegate. If the function returns nullptr, that\n means that the underlying delegate does not support asynchronous execution\n for this `node`."]
1064 pub async_kernel: ::std::option::Option<
1065 unsafe extern "C" fn(
1066 context: *mut TfLiteContext,
1067 node: *mut TfLiteNode,
1068 ) -> *mut TfLiteAsyncKernel,
1069 >,
1070 #[doc = " Indicates if an operator's output may safely overwrite its inputs.\n See the comments in `TfLiteInPlaceOp`."]
1071 pub inplace_operator: u64,
1072}
1073#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1074const _: () = {
1075 ["Size of TfLiteRegistration"][::std::mem::size_of::<TfLiteRegistration>() - 88usize];
1076 ["Alignment of TfLiteRegistration"][::std::mem::align_of::<TfLiteRegistration>() - 8usize];
1077 ["Offset of field: TfLiteRegistration::init"]
1078 [::std::mem::offset_of!(TfLiteRegistration, init) - 0usize];
1079 ["Offset of field: TfLiteRegistration::free"]
1080 [::std::mem::offset_of!(TfLiteRegistration, free) - 8usize];
1081 ["Offset of field: TfLiteRegistration::prepare"]
1082 [::std::mem::offset_of!(TfLiteRegistration, prepare) - 16usize];
1083 ["Offset of field: TfLiteRegistration::invoke"]
1084 [::std::mem::offset_of!(TfLiteRegistration, invoke) - 24usize];
1085 ["Offset of field: TfLiteRegistration::profiling_string"]
1086 [::std::mem::offset_of!(TfLiteRegistration, profiling_string) - 32usize];
1087 ["Offset of field: TfLiteRegistration::builtin_code"]
1088 [::std::mem::offset_of!(TfLiteRegistration, builtin_code) - 40usize];
1089 ["Offset of field: TfLiteRegistration::custom_name"]
1090 [::std::mem::offset_of!(TfLiteRegistration, custom_name) - 48usize];
1091 ["Offset of field: TfLiteRegistration::version"]
1092 [::std::mem::offset_of!(TfLiteRegistration, version) - 56usize];
1093 ["Offset of field: TfLiteRegistration::registration_external"]
1094 [::std::mem::offset_of!(TfLiteRegistration, registration_external) - 64usize];
1095 ["Offset of field: TfLiteRegistration::async_kernel"]
1096 [::std::mem::offset_of!(TfLiteRegistration, async_kernel) - 72usize];
1097 ["Offset of field: TfLiteRegistration::inplace_operator"]
1098 [::std::mem::offset_of!(TfLiteRegistration, inplace_operator) - 80usize];
1099};
1100#[doc = " WARNING: This is an experimental interface that is subject to change."]
1101#[repr(C)]
1102#[derive(Debug, Copy, Clone)]
1103pub struct TfLiteDelegate {
1104 #[doc = " Data that delegate needs to identify itself. This data is owned by the\n delegate. The delegate is owned in the user code, so the delegate is\n responsible for deallocating this when it is destroyed."]
1105 pub data_: *mut ::std::os::raw::c_void,
1106 #[doc = " Invoked by `ModifyGraphWithDelegate`. This prepare is called, giving the\n delegate a view of the current graph through `TfLiteContext*`. It\n typically will look at the nodes and call\n `ReplaceNodeSubsetsWithDelegateKernels()` to ask the TensorFlow lite\n runtime to create macro-nodes to represent delegated subgraphs of the\n original graph."]
1107 pub Prepare: ::std::option::Option<
1108 unsafe extern "C" fn(
1109 context: *mut TfLiteContext,
1110 delegate: *mut TfLiteDelegate,
1111 ) -> TfLiteStatus,
1112 >,
1113 #[doc = " Copy the data from delegate buffer handle into raw memory of the given\n `tensor`. Note that the delegate is allowed to allocate the raw bytes as\n long as it follows the rules for `kTfLiteDynamic` tensors, in which case\n this cannot be null."]
1114 pub CopyFromBufferHandle: ::std::option::Option<
1115 unsafe extern "C" fn(
1116 context: *mut TfLiteContext,
1117 delegate: *mut TfLiteDelegate,
1118 buffer_handle: TfLiteBufferHandle,
1119 tensor: *mut TfLiteTensor,
1120 ) -> TfLiteStatus,
1121 >,
1122 #[doc = " Copy the data from raw memory of the given `tensor` to delegate buffer\n handle. This can be null if the delegate doesn't use its own buffer."]
1123 pub CopyToBufferHandle: ::std::option::Option<
1124 unsafe extern "C" fn(
1125 context: *mut TfLiteContext,
1126 delegate: *mut TfLiteDelegate,
1127 buffer_handle: TfLiteBufferHandle,
1128 tensor: *mut TfLiteTensor,
1129 ) -> TfLiteStatus,
1130 >,
1131 #[doc = " Free the Delegate Buffer Handle. Note: This only frees the handle, but\n this doesn't release the underlying resource (e.g. textures). The\n resources are either owned by application layer or the delegate.\n This can be null if the delegate doesn't use its own buffer."]
1132 pub FreeBufferHandle: ::std::option::Option<
1133 unsafe extern "C" fn(
1134 context: *mut TfLiteContext,
1135 delegate: *mut TfLiteDelegate,
1136 handle: *mut TfLiteBufferHandle,
1137 ),
1138 >,
1139 #[doc = " Bitmask flags. See the comments in `TfLiteDelegateFlags`."]
1140 pub flags: i64,
1141 #[doc = " The opaque delegate builder associated with this object. If set then the\n TF Lite runtime will give precedence to this field. E.g. instead of\n invoking `Prepare` via the function pointer inside the `TfLiteDelegate`\n object, the runtime will first check if the corresponding function\n pointer inside `opaque_delegate_builder` is set and if so invoke that.\n\n If this field is non-null, then the `Prepare` field (of the\n `TfLiteDelegate`) should be null."]
1142 pub opaque_delegate_builder: *mut TfLiteOpaqueDelegateBuilder,
1143}
1144#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1145const _: () = {
1146 ["Size of TfLiteDelegate"][::std::mem::size_of::<TfLiteDelegate>() - 56usize];
1147 ["Alignment of TfLiteDelegate"][::std::mem::align_of::<TfLiteDelegate>() - 8usize];
1148 ["Offset of field: TfLiteDelegate::data_"]
1149 [::std::mem::offset_of!(TfLiteDelegate, data_) - 0usize];
1150 ["Offset of field: TfLiteDelegate::Prepare"]
1151 [::std::mem::offset_of!(TfLiteDelegate, Prepare) - 8usize];
1152 ["Offset of field: TfLiteDelegate::CopyFromBufferHandle"]
1153 [::std::mem::offset_of!(TfLiteDelegate, CopyFromBufferHandle) - 16usize];
1154 ["Offset of field: TfLiteDelegate::CopyToBufferHandle"]
1155 [::std::mem::offset_of!(TfLiteDelegate, CopyToBufferHandle) - 24usize];
1156 ["Offset of field: TfLiteDelegate::FreeBufferHandle"]
1157 [::std::mem::offset_of!(TfLiteDelegate, FreeBufferHandle) - 32usize];
1158 ["Offset of field: TfLiteDelegate::flags"]
1159 [::std::mem::offset_of!(TfLiteDelegate, flags) - 40usize];
1160 ["Offset of field: TfLiteDelegate::opaque_delegate_builder"]
1161 [::std::mem::offset_of!(TfLiteDelegate, opaque_delegate_builder) - 48usize];
1162};
1163#[doc = " `TfLiteOpaqueDelegateBuilder` is used for constructing\n `TfLiteOpaqueDelegate`, see `TfLiteOpaqueDelegateCreate` in c_api_opaque.h.\n NOTE: This struct is not ABI stable.\n\n For forward source compatibility `TfLiteOpaqueDelegateBuilder` objects\n should be brace-initialized, so that all fields (including any that might be\n added in the future) get zero-initialized. The purpose of each field is\n exactly the same as with `TfLiteDelegate`.\n\n NOTE: This type is part of the TensorFlow Lite Extension APIs.\n We reserve the right to make changes to this API in future releases,\n potentially including non-backwards-compatible changes, on a different\n schedule than for the other TensorFlow Lite APIs. See\n https://www.tensorflow.org/guide/versions#separate_version_number_for_tensorflow_lite_extension_apis."]
1164#[repr(C)]
1165#[derive(Debug, Copy, Clone)]
1166pub struct TfLiteOpaqueDelegateBuilder {
1167 #[doc = " Data that delegate needs to identify itself. This data is owned by the\n delegate. The delegate is owned in the user code, so the delegate is\n responsible for deallocating this when it is destroyed."]
1168 pub data: *mut ::std::os::raw::c_void,
1169 #[doc = " Invoked by ModifyGraphWithDelegate. This prepare is called, giving the\n delegate a view of the current graph through `TfLiteContext*`. It\n typically will look at the nodes and call\n `ReplaceNodeSubsetsWithDelegateKernels()` to ask the TensorFlow lite\n runtime to create macro-nodes to represent delegated subgraphs of the\n original graph."]
1170 pub Prepare: ::std::option::Option<
1171 unsafe extern "C" fn(
1172 context: *mut TfLiteOpaqueContext,
1173 delegate: *mut TfLiteOpaqueDelegate,
1174 data: *mut ::std::os::raw::c_void,
1175 ) -> TfLiteStatus,
1176 >,
1177 #[doc = " Copies the data from delegate buffer handle into raw memory of the given\n `tensor`. Note that the delegate is allowed to allocate the raw bytes as\n long as it follows the rules for kTfLiteDynamic tensors, in which case\n this cannot be null."]
1178 pub CopyFromBufferHandle: ::std::option::Option<
1179 unsafe extern "C" fn(
1180 context: *mut TfLiteOpaqueContext,
1181 delegate: *mut TfLiteOpaqueDelegate,
1182 data: *mut ::std::os::raw::c_void,
1183 buffer_handle: TfLiteBufferHandle,
1184 tensor: *mut TfLiteOpaqueTensor,
1185 ) -> TfLiteStatus,
1186 >,
1187 #[doc = " Copies the data from raw memory of the given `tensor` to delegate buffer\n handle. This can be null if the delegate doesn't use its own buffer."]
1188 pub CopyToBufferHandle: ::std::option::Option<
1189 unsafe extern "C" fn(
1190 context: *mut TfLiteOpaqueContext,
1191 delegate: *mut TfLiteOpaqueDelegate,
1192 data: *mut ::std::os::raw::c_void,
1193 buffer_handle: TfLiteBufferHandle,
1194 tensor: *mut TfLiteOpaqueTensor,
1195 ) -> TfLiteStatus,
1196 >,
1197 #[doc = " Frees the Delegate Buffer Handle. Note: This only frees the handle, but\n this doesn't release the underlying resource (e.g. textures). The\n resources are either owned by application layer or the delegate.\n This can be null if the delegate doesn't use its own buffer."]
1198 pub FreeBufferHandle: ::std::option::Option<
1199 unsafe extern "C" fn(
1200 context: *mut TfLiteOpaqueContext,
1201 delegate: *mut TfLiteOpaqueDelegate,
1202 data: *mut ::std::os::raw::c_void,
1203 handle: *mut TfLiteBufferHandle,
1204 ),
1205 >,
1206 #[doc = " Bitmask flags. See the comments in `TfLiteDelegateFlags`."]
1207 pub flags: i64,
1208}
1209#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1210const _: () = {
1211 ["Size of TfLiteOpaqueDelegateBuilder"]
1212 [::std::mem::size_of::<TfLiteOpaqueDelegateBuilder>() - 48usize];
1213 ["Alignment of TfLiteOpaqueDelegateBuilder"]
1214 [::std::mem::align_of::<TfLiteOpaqueDelegateBuilder>() - 8usize];
1215 ["Offset of field: TfLiteOpaqueDelegateBuilder::data"]
1216 [::std::mem::offset_of!(TfLiteOpaqueDelegateBuilder, data) - 0usize];
1217 ["Offset of field: TfLiteOpaqueDelegateBuilder::Prepare"]
1218 [::std::mem::offset_of!(TfLiteOpaqueDelegateBuilder, Prepare) - 8usize];
1219 ["Offset of field: TfLiteOpaqueDelegateBuilder::CopyFromBufferHandle"]
1220 [::std::mem::offset_of!(TfLiteOpaqueDelegateBuilder, CopyFromBufferHandle) - 16usize];
1221 ["Offset of field: TfLiteOpaqueDelegateBuilder::CopyToBufferHandle"]
1222 [::std::mem::offset_of!(TfLiteOpaqueDelegateBuilder, CopyToBufferHandle) - 24usize];
1223 ["Offset of field: TfLiteOpaqueDelegateBuilder::FreeBufferHandle"]
1224 [::std::mem::offset_of!(TfLiteOpaqueDelegateBuilder, FreeBufferHandle) - 32usize];
1225 ["Offset of field: TfLiteOpaqueDelegateBuilder::flags"]
1226 [::std::mem::offset_of!(TfLiteOpaqueDelegateBuilder, flags) - 40usize];
1227};
1228#[repr(C)]
1229#[derive(Debug, Copy, Clone)]
1230pub struct TfLiteOpaqueTensorBuilder {
1231 _unused: [u8; 0],
1232}
1233pub type __builtin_va_list = [__va_list_tag; 1usize];
1234#[repr(C)]
1235#[derive(Debug, Copy, Clone)]
1236pub struct __va_list_tag {
1237 pub gp_offset: ::std::os::raw::c_uint,
1238 pub fp_offset: ::std::os::raw::c_uint,
1239 pub overflow_arg_area: *mut ::std::os::raw::c_void,
1240 pub reg_save_area: *mut ::std::os::raw::c_void,
1241}
1242#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1243const _: () = {
1244 ["Size of __va_list_tag"][::std::mem::size_of::<__va_list_tag>() - 24usize];
1245 ["Alignment of __va_list_tag"][::std::mem::align_of::<__va_list_tag>() - 8usize];
1246 ["Offset of field: __va_list_tag::gp_offset"]
1247 [::std::mem::offset_of!(__va_list_tag, gp_offset) - 0usize];
1248 ["Offset of field: __va_list_tag::fp_offset"]
1249 [::std::mem::offset_of!(__va_list_tag, fp_offset) - 4usize];
1250 ["Offset of field: __va_list_tag::overflow_arg_area"]
1251 [::std::mem::offset_of!(__va_list_tag, overflow_arg_area) - 8usize];
1252 ["Offset of field: __va_list_tag::reg_save_area"]
1253 [::std::mem::offset_of!(__va_list_tag, reg_save_area) - 16usize];
1254};
1255pub struct tensorflowlite_c {
1256 __library: ::libloading::Library,
1257 pub TfLiteOperatorCreate: Result<
1258 unsafe extern "C" fn(
1259 builtin_code: TfLiteBuiltinOperator,
1260 custom_name: *const ::std::os::raw::c_char,
1261 version: ::std::os::raw::c_int,
1262 user_data: *mut ::std::os::raw::c_void,
1263 ) -> *mut TfLiteOperator,
1264 ::libloading::Error,
1265 >,
1266 pub TfLiteOperatorDelete:
1267 Result<unsafe extern "C" fn(registration: *mut TfLiteOperator), ::libloading::Error>,
1268 pub TfLiteOperatorGetBuiltInCode: Result<
1269 unsafe extern "C" fn(registration: *const TfLiteOperator) -> TfLiteBuiltinOperator,
1270 ::libloading::Error,
1271 >,
1272 pub TfLiteOperatorGetCustomName: Result<
1273 unsafe extern "C" fn(registration: *const TfLiteOperator) -> *const ::std::os::raw::c_char,
1274 ::libloading::Error,
1275 >,
1276 pub TfLiteOperatorGetVersion: Result<
1277 unsafe extern "C" fn(registration: *const TfLiteOperator) -> ::std::os::raw::c_int,
1278 ::libloading::Error,
1279 >,
1280 pub TfLiteOperatorGetUserData: Result<
1281 unsafe extern "C" fn(registration: *const TfLiteOperator) -> *mut ::std::os::raw::c_void,
1282 ::libloading::Error,
1283 >,
1284 pub TfLiteOperatorSetInit: Result<
1285 unsafe extern "C" fn(
1286 registration: *mut TfLiteOperator,
1287 init: ::std::option::Option<
1288 unsafe extern "C" fn(
1289 context: *mut TfLiteOpaqueContext,
1290 buffer: *const ::std::os::raw::c_char,
1291 length: usize,
1292 ) -> *mut ::std::os::raw::c_void,
1293 >,
1294 ),
1295 ::libloading::Error,
1296 >,
1297 pub TfLiteOperatorSetInitWithData: Result<
1298 unsafe extern "C" fn(
1299 registration: *mut TfLiteOperator,
1300 init: ::std::option::Option<
1301 unsafe extern "C" fn(
1302 user_data: *mut ::std::os::raw::c_void,
1303 context: *mut TfLiteOpaqueContext,
1304 buffer: *const ::std::os::raw::c_char,
1305 length: usize,
1306 ) -> *mut ::std::os::raw::c_void,
1307 >,
1308 ) -> TfLiteStatus,
1309 ::libloading::Error,
1310 >,
1311 pub TfLiteOperatorSetFree: Result<
1312 unsafe extern "C" fn(
1313 registration: *mut TfLiteOperator,
1314 free: ::std::option::Option<
1315 unsafe extern "C" fn(
1316 context: *mut TfLiteOpaqueContext,
1317 data: *mut ::std::os::raw::c_void,
1318 ),
1319 >,
1320 ),
1321 ::libloading::Error,
1322 >,
1323 pub TfLiteOperatorSetFreeWithData: Result<
1324 unsafe extern "C" fn(
1325 registration: *mut TfLiteOperator,
1326 free: ::std::option::Option<
1327 unsafe extern "C" fn(
1328 user_data: *mut ::std::os::raw::c_void,
1329 context: *mut TfLiteOpaqueContext,
1330 data: *mut ::std::os::raw::c_void,
1331 ),
1332 >,
1333 ) -> TfLiteStatus,
1334 ::libloading::Error,
1335 >,
1336 pub TfLiteOperatorSetPrepare: Result<
1337 unsafe extern "C" fn(
1338 registration: *mut TfLiteOperator,
1339 prepare: ::std::option::Option<
1340 unsafe extern "C" fn(
1341 context: *mut TfLiteOpaqueContext,
1342 node: *mut TfLiteOpaqueNode,
1343 ) -> TfLiteStatus,
1344 >,
1345 ),
1346 ::libloading::Error,
1347 >,
1348 pub TfLiteOperatorSetPrepareWithData: Result<
1349 unsafe extern "C" fn(
1350 registration: *mut TfLiteOperator,
1351 prepare: ::std::option::Option<
1352 unsafe extern "C" fn(
1353 user_data: *mut ::std::os::raw::c_void,
1354 context: *mut TfLiteOpaqueContext,
1355 node: *mut TfLiteOpaqueNode,
1356 ) -> TfLiteStatus,
1357 >,
1358 ) -> TfLiteStatus,
1359 ::libloading::Error,
1360 >,
1361 pub TfLiteOperatorSetInvoke: Result<
1362 unsafe extern "C" fn(
1363 registration: *mut TfLiteOperator,
1364 invoke: ::std::option::Option<
1365 unsafe extern "C" fn(
1366 context: *mut TfLiteOpaqueContext,
1367 node: *mut TfLiteOpaqueNode,
1368 ) -> TfLiteStatus,
1369 >,
1370 ),
1371 ::libloading::Error,
1372 >,
1373 pub TfLiteOperatorSetInvokeWithData: Result<
1374 unsafe extern "C" fn(
1375 registration: *mut TfLiteOperator,
1376 invoke: ::std::option::Option<
1377 unsafe extern "C" fn(
1378 user_data: *mut ::std::os::raw::c_void,
1379 context: *mut TfLiteOpaqueContext,
1380 node: *mut TfLiteOpaqueNode,
1381 ) -> TfLiteStatus,
1382 >,
1383 ) -> TfLiteStatus,
1384 ::libloading::Error,
1385 >,
1386 pub TfLiteOperatorSetAsyncKernel: Result<
1387 unsafe extern "C" fn(
1388 registration: *mut TfLiteOperator,
1389 async_kernel: ::std::option::Option<
1390 unsafe extern "C" fn(
1391 context: *mut TfLiteOpaqueContext,
1392 node: *mut TfLiteOpaqueNode,
1393 ) -> *mut TfLiteAsyncKernel,
1394 >,
1395 ),
1396 ::libloading::Error,
1397 >,
1398 pub TfLiteOperatorSetAsyncKernelWithData: Result<
1399 unsafe extern "C" fn(
1400 registration: *mut TfLiteOperator,
1401 async_kernel: ::std::option::Option<
1402 unsafe extern "C" fn(
1403 user_data: *mut ::std::os::raw::c_void,
1404 context: *mut TfLiteOpaqueContext,
1405 node: *mut TfLiteOpaqueNode,
1406 ) -> *mut TfLiteAsyncKernel,
1407 >,
1408 ) -> TfLiteStatus,
1409 ::libloading::Error,
1410 >,
1411 pub TfLiteOperatorSetInplaceOperator: Result<
1412 unsafe extern "C" fn(registration: *mut TfLiteOperator, inplace_operator: u64),
1413 ::libloading::Error,
1414 >,
1415 pub TfLiteVersion:
1416 Result<unsafe extern "C" fn() -> *const ::std::os::raw::c_char, ::libloading::Error>,
1417 pub TfLiteExtensionApisVersion:
1418 Result<unsafe extern "C" fn() -> *const ::std::os::raw::c_char, ::libloading::Error>,
1419 pub TfLiteSchemaVersion:
1420 Result<unsafe extern "C" fn() -> ::std::os::raw::c_int, ::libloading::Error>,
1421 pub TfLiteModelCreate: Result<
1422 unsafe extern "C" fn(
1423 model_data: *const ::std::os::raw::c_void,
1424 model_size: usize,
1425 ) -> *mut TfLiteModel,
1426 ::libloading::Error,
1427 >,
1428 pub TfLiteModelCreateWithErrorReporter: Result<
1429 unsafe extern "C" fn(
1430 model_data: *const ::std::os::raw::c_void,
1431 model_size: usize,
1432 reporter: ::std::option::Option<
1433 unsafe extern "C" fn(
1434 user_data: *mut ::std::os::raw::c_void,
1435 format: *const ::std::os::raw::c_char,
1436 args: *mut __va_list_tag,
1437 ),
1438 >,
1439 user_data: *mut ::std::os::raw::c_void,
1440 ) -> *mut TfLiteModel,
1441 ::libloading::Error,
1442 >,
1443 pub TfLiteModelCreateFromFile: Result<
1444 unsafe extern "C" fn(model_path: *const ::std::os::raw::c_char) -> *mut TfLiteModel,
1445 ::libloading::Error,
1446 >,
1447 pub TfLiteModelCreateFromFileWithErrorReporter: Result<
1448 unsafe extern "C" fn(
1449 model_path: *const ::std::os::raw::c_char,
1450 reporter: ::std::option::Option<
1451 unsafe extern "C" fn(
1452 user_data: *mut ::std::os::raw::c_void,
1453 format: *const ::std::os::raw::c_char,
1454 args: *mut __va_list_tag,
1455 ),
1456 >,
1457 user_data: *mut ::std::os::raw::c_void,
1458 ) -> *mut TfLiteModel,
1459 ::libloading::Error,
1460 >,
1461 pub TfLiteModelDelete:
1462 Result<unsafe extern "C" fn(model: *mut TfLiteModel), ::libloading::Error>,
1463 pub TfLiteInterpreterOptionsCreate:
1464 Result<unsafe extern "C" fn() -> *mut TfLiteInterpreterOptions, ::libloading::Error>,
1465 pub TfLiteInterpreterOptionsCopy: Result<
1466 unsafe extern "C" fn(
1467 from: *const TfLiteInterpreterOptions,
1468 ) -> *mut TfLiteInterpreterOptions,
1469 ::libloading::Error,
1470 >,
1471 pub TfLiteInterpreterOptionsDelete:
1472 Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions), ::libloading::Error>,
1473 pub TfLiteInterpreterOptionsSetNumThreads: Result<
1474 unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, num_threads: i32),
1475 ::libloading::Error,
1476 >,
1477 pub TfLiteInterpreterOptionsAddDelegate: Result<
1478 unsafe extern "C" fn(
1479 options: *mut TfLiteInterpreterOptions,
1480 delegate: *mut TfLiteOpaqueDelegate,
1481 ),
1482 ::libloading::Error,
1483 >,
1484 pub TfLiteInterpreterOptionsSetErrorReporter: Result<
1485 unsafe extern "C" fn(
1486 options: *mut TfLiteInterpreterOptions,
1487 reporter: ::std::option::Option<
1488 unsafe extern "C" fn(
1489 user_data: *mut ::std::os::raw::c_void,
1490 format: *const ::std::os::raw::c_char,
1491 args: *mut __va_list_tag,
1492 ),
1493 >,
1494 user_data: *mut ::std::os::raw::c_void,
1495 ),
1496 ::libloading::Error,
1497 >,
1498 pub TfLiteInterpreterOptionsAddOperator: Result<
1499 unsafe extern "C" fn(
1500 options: *mut TfLiteInterpreterOptions,
1501 registration: *mut TfLiteOperator,
1502 ),
1503 ::libloading::Error,
1504 >,
1505 pub TfLiteInterpreterOptionsEnableCancellation: Result<
1506 unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, enable: bool) -> TfLiteStatus,
1507 ::libloading::Error,
1508 >,
1509 pub TfLiteInterpreterCreate: Result<
1510 unsafe extern "C" fn(
1511 model: *const TfLiteModel,
1512 optional_options: *const TfLiteInterpreterOptions,
1513 ) -> *mut TfLiteInterpreter,
1514 ::libloading::Error,
1515 >,
1516 pub TfLiteInterpreterDelete:
1517 Result<unsafe extern "C" fn(interpreter: *mut TfLiteInterpreter), ::libloading::Error>,
1518 pub TfLiteInterpreterGetInputTensorCount: Result<
1519 unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> i32,
1520 ::libloading::Error,
1521 >,
1522 pub TfLiteInterpreterInputTensorIndices: Result<
1523 unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> *const ::std::os::raw::c_int,
1524 ::libloading::Error,
1525 >,
1526 pub TfLiteInterpreterGetInputTensor: Result<
1527 unsafe extern "C" fn(
1528 interpreter: *const TfLiteInterpreter,
1529 input_index: i32,
1530 ) -> *mut TfLiteTensor,
1531 ::libloading::Error,
1532 >,
1533 pub TfLiteInterpreterResizeInputTensor: Result<
1534 unsafe extern "C" fn(
1535 interpreter: *mut TfLiteInterpreter,
1536 input_index: i32,
1537 input_dims: *const ::std::os::raw::c_int,
1538 input_dims_size: i32,
1539 ) -> TfLiteStatus,
1540 ::libloading::Error,
1541 >,
1542 pub TfLiteInterpreterAllocateTensors: Result<
1543 unsafe extern "C" fn(interpreter: *mut TfLiteInterpreter) -> TfLiteStatus,
1544 ::libloading::Error,
1545 >,
1546 pub TfLiteInterpreterInvoke: Result<
1547 unsafe extern "C" fn(interpreter: *mut TfLiteInterpreter) -> TfLiteStatus,
1548 ::libloading::Error,
1549 >,
1550 pub TfLiteInterpreterGetOutputTensorCount: Result<
1551 unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> i32,
1552 ::libloading::Error,
1553 >,
1554 pub TfLiteInterpreterOutputTensorIndices: Result<
1555 unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> *const ::std::os::raw::c_int,
1556 ::libloading::Error,
1557 >,
1558 pub TfLiteInterpreterGetOutputTensor: Result<
1559 unsafe extern "C" fn(
1560 interpreter: *const TfLiteInterpreter,
1561 output_index: i32,
1562 ) -> *const TfLiteTensor,
1563 ::libloading::Error,
1564 >,
1565 pub TfLiteInterpreterGetTensor: Result<
1566 unsafe extern "C" fn(
1567 interpreter: *const TfLiteInterpreter,
1568 index: ::std::os::raw::c_int,
1569 ) -> *mut TfLiteTensor,
1570 ::libloading::Error,
1571 >,
1572 pub TfLiteInterpreterCancel: Result<
1573 unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> TfLiteStatus,
1574 ::libloading::Error,
1575 >,
1576 pub TfLiteInterpreterGetSignatureCount: Result<
1577 unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> i32,
1578 ::libloading::Error,
1579 >,
1580 pub TfLiteInterpreterGetSignatureKey: Result<
1581 unsafe extern "C" fn(
1582 interpreter: *const TfLiteInterpreter,
1583 signature_index: i32,
1584 ) -> *const ::std::os::raw::c_char,
1585 ::libloading::Error,
1586 >,
1587 pub TfLiteInterpreterGetSignatureRunner: Result<
1588 unsafe extern "C" fn(
1589 interpreter: *const TfLiteInterpreter,
1590 signature_key: *const ::std::os::raw::c_char,
1591 ) -> *mut TfLiteSignatureRunner,
1592 ::libloading::Error,
1593 >,
1594 pub TfLiteSignatureRunnerGetInputCount: Result<
1595 unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner) -> usize,
1596 ::libloading::Error,
1597 >,
1598 pub TfLiteSignatureRunnerGetInputName: Result<
1599 unsafe extern "C" fn(
1600 signature_runner: *const TfLiteSignatureRunner,
1601 input_index: i32,
1602 ) -> *const ::std::os::raw::c_char,
1603 ::libloading::Error,
1604 >,
1605 pub TfLiteSignatureRunnerResizeInputTensor: Result<
1606 unsafe extern "C" fn(
1607 signature_runner: *mut TfLiteSignatureRunner,
1608 input_name: *const ::std::os::raw::c_char,
1609 input_dims: *const ::std::os::raw::c_int,
1610 input_dims_size: i32,
1611 ) -> TfLiteStatus,
1612 ::libloading::Error,
1613 >,
1614 pub TfLiteSignatureRunnerAllocateTensors: Result<
1615 unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner) -> TfLiteStatus,
1616 ::libloading::Error,
1617 >,
1618 pub TfLiteSignatureRunnerGetInputTensor: Result<
1619 unsafe extern "C" fn(
1620 signature_runner: *mut TfLiteSignatureRunner,
1621 input_name: *const ::std::os::raw::c_char,
1622 ) -> *mut TfLiteTensor,
1623 ::libloading::Error,
1624 >,
1625 pub TfLiteSignatureRunnerInvoke: Result<
1626 unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner) -> TfLiteStatus,
1627 ::libloading::Error,
1628 >,
1629 pub TfLiteSignatureRunnerGetOutputCount: Result<
1630 unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner) -> usize,
1631 ::libloading::Error,
1632 >,
1633 pub TfLiteSignatureRunnerGetOutputName: Result<
1634 unsafe extern "C" fn(
1635 signature_runner: *const TfLiteSignatureRunner,
1636 output_index: i32,
1637 ) -> *const ::std::os::raw::c_char,
1638 ::libloading::Error,
1639 >,
1640 pub TfLiteSignatureRunnerGetOutputTensor: Result<
1641 unsafe extern "C" fn(
1642 signature_runner: *const TfLiteSignatureRunner,
1643 output_name: *const ::std::os::raw::c_char,
1644 ) -> *const TfLiteTensor,
1645 ::libloading::Error,
1646 >,
1647 pub TfLiteTensorType: Result<
1648 unsafe extern "C" fn(tensor: *const TfLiteTensor) -> TfLiteType,
1649 ::libloading::Error,
1650 >,
1651 pub TfLiteTensorNumDims:
1652 Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> i32, ::libloading::Error>,
1653 pub TfLiteTensorDim: Result<
1654 unsafe extern "C" fn(tensor: *const TfLiteTensor, dim_index: i32) -> i32,
1655 ::libloading::Error,
1656 >,
1657 pub TfLiteTensorByteSize:
1658 Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> usize, ::libloading::Error>,
1659 pub TfLiteTensorData: Result<
1660 unsafe extern "C" fn(tensor: *const TfLiteTensor) -> *mut ::std::os::raw::c_void,
1661 ::libloading::Error,
1662 >,
1663 pub TfLiteTensorName: Result<
1664 unsafe extern "C" fn(tensor: *const TfLiteTensor) -> *const ::std::os::raw::c_char,
1665 ::libloading::Error,
1666 >,
1667 pub TfLiteTensorQuantizationParams: Result<
1668 unsafe extern "C" fn(tensor: *const TfLiteTensor) -> TfLiteQuantizationParams,
1669 ::libloading::Error,
1670 >,
1671 pub TfLiteTensorCopyFromBuffer: Result<
1672 unsafe extern "C" fn(
1673 tensor: *mut TfLiteTensor,
1674 input_data: *const ::std::os::raw::c_void,
1675 input_data_size: usize,
1676 ) -> TfLiteStatus,
1677 ::libloading::Error,
1678 >,
1679 pub TfLiteTensorCopyToBuffer: Result<
1680 unsafe extern "C" fn(
1681 output_tensor: *const TfLiteTensor,
1682 output_data: *mut ::std::os::raw::c_void,
1683 output_data_size: usize,
1684 ) -> TfLiteStatus,
1685 ::libloading::Error,
1686 >,
1687 pub TfLiteSignatureRunnerDelete: Result<
1688 unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner),
1689 ::libloading::Error,
1690 >,
1691 pub TfLiteIntArrayGetSizeInBytes:
1692 Result<unsafe extern "C" fn(size: ::std::os::raw::c_int) -> usize, ::libloading::Error>,
1693 pub TfLiteIntArrayCreate: Result<
1694 unsafe extern "C" fn(size: ::std::os::raw::c_int) -> *mut TfLiteIntArray,
1695 ::libloading::Error,
1696 >,
1697 pub TfLiteIntArrayEqual: Result<
1698 unsafe extern "C" fn(
1699 a: *const TfLiteIntArray,
1700 b: *const TfLiteIntArray,
1701 ) -> ::std::os::raw::c_int,
1702 ::libloading::Error,
1703 >,
1704 pub TfLiteIntArrayEqualsArray: Result<
1705 unsafe extern "C" fn(
1706 a: *const TfLiteIntArray,
1707 b_size: ::std::os::raw::c_int,
1708 b_data: *const ::std::os::raw::c_int,
1709 ) -> ::std::os::raw::c_int,
1710 ::libloading::Error,
1711 >,
1712 pub TfLiteIntArrayCopy: Result<
1713 unsafe extern "C" fn(src: *const TfLiteIntArray) -> *mut TfLiteIntArray,
1714 ::libloading::Error,
1715 >,
1716 pub TfLiteIntArrayFree:
1717 Result<unsafe extern "C" fn(a: *mut TfLiteIntArray), ::libloading::Error>,
1718 pub TfLiteFloatArrayGetSizeInBytes: Result<
1719 unsafe extern "C" fn(size: ::std::os::raw::c_int) -> ::std::os::raw::c_int,
1720 ::libloading::Error,
1721 >,
1722 pub TfLiteFloatArrayCreate: Result<
1723 unsafe extern "C" fn(size: ::std::os::raw::c_int) -> *mut TfLiteFloatArray,
1724 ::libloading::Error,
1725 >,
1726 pub TfLiteFloatArrayCopy: Result<
1727 unsafe extern "C" fn(src: *const TfLiteFloatArray) -> *mut TfLiteFloatArray,
1728 ::libloading::Error,
1729 >,
1730 pub TfLiteFloatArrayFree:
1731 Result<unsafe extern "C" fn(a: *mut TfLiteFloatArray), ::libloading::Error>,
1732 pub TfLiteTypeGetName: Result<
1733 unsafe extern "C" fn(type_: TfLiteType) -> *const ::std::os::raw::c_char,
1734 ::libloading::Error,
1735 >,
1736 pub TfLiteTensorDataFree:
1737 Result<unsafe extern "C" fn(t: *mut TfLiteTensor), ::libloading::Error>,
1738 pub TfLiteQuantizationFree:
1739 Result<unsafe extern "C" fn(quantization: *mut TfLiteQuantization), ::libloading::Error>,
1740 pub TfLiteSparsityFree:
1741 Result<unsafe extern "C" fn(sparsity: *mut TfLiteSparsity), ::libloading::Error>,
1742 pub TfLiteTensorFree: Result<unsafe extern "C" fn(t: *mut TfLiteTensor), ::libloading::Error>,
1743 pub TfLiteTensorReset: Result<
1744 unsafe extern "C" fn(
1745 type_: TfLiteType,
1746 name: *const ::std::os::raw::c_char,
1747 dims: *mut TfLiteIntArray,
1748 quantization: TfLiteQuantizationParams,
1749 buffer: *mut ::std::os::raw::c_char,
1750 size: usize,
1751 allocation_type: TfLiteAllocationType,
1752 allocation: *const ::std::os::raw::c_void,
1753 is_variable: bool,
1754 tensor: *mut TfLiteTensor,
1755 ),
1756 ::libloading::Error,
1757 >,
1758 pub TfLiteTensorCopy: Result<
1759 unsafe extern "C" fn(src: *const TfLiteTensor, dst: *mut TfLiteTensor) -> TfLiteStatus,
1760 ::libloading::Error,
1761 >,
1762 pub TfLiteTensorResizeMaybeCopy: Result<
1763 unsafe extern "C" fn(
1764 num_bytes: usize,
1765 tensor: *mut TfLiteTensor,
1766 preserve_data: bool,
1767 ) -> TfLiteStatus,
1768 ::libloading::Error,
1769 >,
1770 pub TfLiteTensorRealloc: Result<
1771 unsafe extern "C" fn(num_bytes: usize, tensor: *mut TfLiteTensor) -> TfLiteStatus,
1772 ::libloading::Error,
1773 >,
1774 pub TfLiteDelegateCreate: Result<unsafe extern "C" fn() -> TfLiteDelegate, ::libloading::Error>,
1775 pub TfLiteOpaqueDelegateCreate: Result<
1776 unsafe extern "C" fn(
1777 opaque_delegate_builder: *const TfLiteOpaqueDelegateBuilder,
1778 ) -> *mut TfLiteOpaqueDelegate,
1779 ::libloading::Error,
1780 >,
1781 pub TfLiteOpaqueDelegateDelete:
1782 Result<unsafe extern "C" fn(delegate: *mut TfLiteOpaqueDelegate), ::libloading::Error>,
1783 pub TfLiteOpaqueDelegateGetData: Result<
1784 unsafe extern "C" fn(delegate: *const TfLiteOpaqueDelegate) -> *mut ::std::os::raw::c_void,
1785 ::libloading::Error,
1786 >,
1787 pub TfLiteTensorGetAllocationStrategy: Result<
1788 unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteAllocationStrategy,
1789 ::libloading::Error,
1790 >,
1791 pub TfLiteTensorGetBufferAddressStability: Result<
1792 unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStability,
1793 ::libloading::Error,
1794 >,
1795 pub TfLiteTensorGetDataStability: Result<
1796 unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStability,
1797 ::libloading::Error,
1798 >,
1799 pub TfLiteTensorGetDataKnownStep:
1800 Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStep, ::libloading::Error>,
1801 pub TfLiteTensorGetShapeKnownStep:
1802 Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStep, ::libloading::Error>,
1803 pub TfLiteOpaqueTensorType: Result<
1804 unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteType,
1805 ::libloading::Error,
1806 >,
1807 pub TfLiteOpaqueTensorNumDims: Result<
1808 unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> i32,
1809 ::libloading::Error,
1810 >,
1811 pub TfLiteOpaqueTensorDim: Result<
1812 unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor, dim_index: i32) -> i32,
1813 ::libloading::Error,
1814 >,
1815 pub TfLiteOpaqueTensorGetNumDimsSignature: Result<
1816 unsafe extern "C" fn(
1817 opaque_tensor: *const TfLiteOpaqueTensor,
1818 num_dims: *mut i32,
1819 ) -> TfLiteStatus,
1820 ::libloading::Error,
1821 >,
1822 pub TfLiteOpaqueTensorGetDimSignature: Result<
1823 unsafe extern "C" fn(
1824 opaque_tensor: *const TfLiteOpaqueTensor,
1825 dim_index: i32,
1826 dim_length: *mut i32,
1827 ) -> TfLiteStatus,
1828 ::libloading::Error,
1829 >,
1830 pub TfLiteOpaqueTensorIsVariable: Result<
1831 unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> ::std::os::raw::c_int,
1832 ::libloading::Error,
1833 >,
1834 pub TfLiteOpaqueTensorByteSize: Result<
1835 unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> usize,
1836 ::libloading::Error,
1837 >,
1838 pub TfLiteOpaqueTensorData: Result<
1839 unsafe extern "C" fn(
1840 opaque_tensor: *const TfLiteOpaqueTensor,
1841 ) -> *mut ::std::os::raw::c_void,
1842 ::libloading::Error,
1843 >,
1844 pub TfLiteOpaqueTensorGetAllocationType: Result<
1845 unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteAllocationType,
1846 ::libloading::Error,
1847 >,
1848 pub TfLiteOpaqueTensorGetAllocationStrategy: Result<
1849 unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteAllocationStrategy,
1850 ::libloading::Error,
1851 >,
1852 pub TfLiteOpaqueTensorGetBufferAddressStability: Result<
1853 unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStability,
1854 ::libloading::Error,
1855 >,
1856 pub TfLiteOpaqueTensorGetDataStability: Result<
1857 unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStability,
1858 ::libloading::Error,
1859 >,
1860 pub TfLiteOpaqueTensorGetDataKnownStep: Result<
1861 unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStep,
1862 ::libloading::Error,
1863 >,
1864 pub TfLiteOpaqueTensorGetShapeKnownStep: Result<
1865 unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStep,
1866 ::libloading::Error,
1867 >,
1868 pub TfLiteOpaqueTensorName: Result<
1869 unsafe extern "C" fn(
1870 opaque_tensor: *const TfLiteOpaqueTensor,
1871 ) -> *const ::std::os::raw::c_char,
1872 ::libloading::Error,
1873 >,
1874 pub TfLiteOpaqueTensorGetQuantization: Result<
1875 unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteQuantization,
1876 ::libloading::Error,
1877 >,
1878 pub TfLiteOpaqueTensorGetQuantizationParams: Result<
1879 unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteQuantizationParams,
1880 ::libloading::Error,
1881 >,
1882 pub TfLiteOpaqueTensorCopyFromBuffer: Result<
1883 unsafe extern "C" fn(
1884 opaque_tensor: *mut TfLiteOpaqueTensor,
1885 input_data: *const ::std::os::raw::c_void,
1886 input_data_size: usize,
1887 ) -> TfLiteStatus,
1888 ::libloading::Error,
1889 >,
1890 pub TfLiteOpaqueTensorCopyToBuffer: Result<
1891 unsafe extern "C" fn(
1892 opaque_tensor: *const TfLiteOpaqueTensor,
1893 output_data: *mut ::std::os::raw::c_void,
1894 output_data_size: usize,
1895 ) -> TfLiteStatus,
1896 ::libloading::Error,
1897 >,
1898 pub TfLiteOpaqueTensorGetStringCount: Result<
1899 unsafe extern "C" fn(tensor: *const TfLiteOpaqueTensor) -> ::std::os::raw::c_int,
1900 ::libloading::Error,
1901 >,
1902 pub TfLiteOpaqueTensorGetString: Result<
1903 unsafe extern "C" fn(
1904 tensor: *const TfLiteOpaqueTensor,
1905 index: ::std::os::raw::c_int,
1906 str_: *mut *const ::std::os::raw::c_char,
1907 len: *mut ::std::os::raw::c_int,
1908 ) -> TfLiteStatus,
1909 ::libloading::Error,
1910 >,
1911 pub TfLiteOpaqueTensorWriteStrings: Result<
1912 unsafe extern "C" fn(
1913 tensor: *mut TfLiteOpaqueTensor,
1914 str_array: *const *const ::std::os::raw::c_char,
1915 str_array_len: ::std::os::raw::c_int,
1916 str_n_len: *const ::std::os::raw::c_int,
1917 ) -> TfLiteStatus,
1918 ::libloading::Error,
1919 >,
1920 pub TfLiteOpaqueTensorWriteString: Result<
1921 unsafe extern "C" fn(
1922 tensor: *mut TfLiteOpaqueTensor,
1923 str_: *const ::std::os::raw::c_char,
1924 len: ::std::os::raw::c_int,
1925 ) -> TfLiteStatus,
1926 ::libloading::Error,
1927 >,
1928 pub TfLiteOpaqueTensorBuilderCreate:
1929 Result<unsafe extern "C" fn() -> *mut TfLiteOpaqueTensorBuilder, ::libloading::Error>,
1930 pub TfLiteOpaqueTensorBuilderDelete:
1931 Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder), ::libloading::Error>,
1932 pub TfLiteOpaqueTensorBuilderSetType: Result<
1933 unsafe extern "C" fn(
1934 builder: *mut TfLiteOpaqueTensorBuilder,
1935 type_: TfLiteType,
1936 ) -> *mut TfLiteOpaqueTensorBuilder,
1937 ::libloading::Error,
1938 >,
1939 pub TfLiteOpaqueTensorBuilderSetData: Result<
1940 unsafe extern "C" fn(
1941 builder: *mut TfLiteOpaqueTensorBuilder,
1942 data: *mut ::std::os::raw::c_void,
1943 ) -> *mut TfLiteOpaqueTensorBuilder,
1944 ::libloading::Error,
1945 >,
1946 pub TfLiteOpaqueTensorBuilderSetAllocationType: Result<
1947 unsafe extern "C" fn(
1948 builder: *mut TfLiteOpaqueTensorBuilder,
1949 allocation_type: TfLiteAllocationType,
1950 ) -> *mut TfLiteOpaqueTensorBuilder,
1951 ::libloading::Error,
1952 >,
1953 pub TfLiteOpaqueTensorBuilderSetQuantizationParams: Result<
1954 unsafe extern "C" fn(
1955 builder: *mut TfLiteOpaqueTensorBuilder,
1956 params: TfLiteQuantizationParams,
1957 ) -> *mut TfLiteOpaqueTensorBuilder,
1958 ::libloading::Error,
1959 >,
1960 pub TfLiteOpaqueTensorBuilderSetQuantization: Result<
1961 unsafe extern "C" fn(
1962 builder: *mut TfLiteOpaqueTensorBuilder,
1963 quantization: TfLiteQuantization,
1964 ) -> *mut TfLiteOpaqueTensorBuilder,
1965 ::libloading::Error,
1966 >,
1967 pub TfLiteOpaqueTensorSetAllocationTypeToDynamic:
1968 Result<unsafe extern "C" fn(tensor: *mut TfLiteOpaqueTensor), ::libloading::Error>,
1969 pub TfLiteOpaqueNodeGetInput: Result<
1970 unsafe extern "C" fn(
1971 opaque_context: *const TfLiteOpaqueContext,
1972 opaque_node: *const TfLiteOpaqueNode,
1973 index: ::std::os::raw::c_int,
1974 ) -> *const TfLiteOpaqueTensor,
1975 ::libloading::Error,
1976 >,
1977 pub TfLiteOpaqueNodeGetOutput: Result<
1978 unsafe extern "C" fn(
1979 opaque_context: *mut TfLiteOpaqueContext,
1980 opaque_node: *const TfLiteOpaqueNode,
1981 index: ::std::os::raw::c_int,
1982 ) -> *mut TfLiteOpaqueTensor,
1983 ::libloading::Error,
1984 >,
1985 pub TfLiteOpaqueNodeNumberOfInputs: Result<
1986 unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> ::std::os::raw::c_int,
1987 ::libloading::Error,
1988 >,
1989 pub TfLiteOpaqueNodeNumberOfOutputs: Result<
1990 unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> ::std::os::raw::c_int,
1991 ::libloading::Error,
1992 >,
1993 pub TfLiteOpaqueNodeGetUserData: Result<
1994 unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> *mut ::std::os::raw::c_void,
1995 ::libloading::Error,
1996 >,
1997 pub TfLiteOpaqueNodeGetBuiltinData: Result<
1998 unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> *mut ::std::os::raw::c_void,
1999 ::libloading::Error,
2000 >,
2001 pub TfLiteOpaqueNodeGetCustomInitialData: Result<
2002 unsafe extern "C" fn(
2003 opaque_node: *const TfLiteOpaqueNode,
2004 init_data: *mut *const ::std::os::raw::c_void,
2005 size: *mut ::std::os::raw::c_int,
2006 ) -> TfLiteStatus,
2007 ::libloading::Error,
2008 >,
2009 pub TfLiteOpaqueNodeInputs: Result<
2010 unsafe extern "C" fn(
2011 opaque_node: *const TfLiteOpaqueNode,
2012 inputs: *mut *const ::std::os::raw::c_int,
2013 num_inputs: *mut ::std::os::raw::c_int,
2014 ) -> TfLiteStatus,
2015 ::libloading::Error,
2016 >,
2017 pub TfLiteOpaqueNodeOutputs: Result<
2018 unsafe extern "C" fn(
2019 opaque_node: *const TfLiteOpaqueNode,
2020 outputs: *mut *const ::std::os::raw::c_int,
2021 num_outputs: *mut ::std::os::raw::c_int,
2022 ) -> TfLiteStatus,
2023 ::libloading::Error,
2024 >,
2025 pub TfLiteOpaqueNodeSetTemporaries: Result<
2026 unsafe extern "C" fn(
2027 opaque_node: *mut TfLiteOpaqueNode,
2028 temporaries: *const ::std::os::raw::c_int,
2029 num_temporaries: ::std::os::raw::c_int,
2030 ) -> TfLiteStatus,
2031 ::libloading::Error,
2032 >,
2033 pub TfLiteOpaqueNodeTemporaries: Result<
2034 unsafe extern "C" fn(
2035 opaque_node: *const TfLiteOpaqueNode,
2036 temporaries: *mut *const ::std::os::raw::c_int,
2037 num_temporaries: *mut ::std::os::raw::c_int,
2038 ) -> TfLiteStatus,
2039 ::libloading::Error,
2040 >,
2041 pub TfLiteOpaqueNodeGetInputTensorIndex: Result<
2042 unsafe extern "C" fn(
2043 opaque_node: *const TfLiteOpaqueNode,
2044 index_of_input: ::std::os::raw::c_int,
2045 ) -> ::std::os::raw::c_int,
2046 ::libloading::Error,
2047 >,
2048 pub TfLiteOpaqueNodeGetOutputTensorIndex: Result<
2049 unsafe extern "C" fn(
2050 opaque_node: *const TfLiteOpaqueNode,
2051 index_of_output: ::std::os::raw::c_int,
2052 ) -> ::std::os::raw::c_int,
2053 ::libloading::Error,
2054 >,
2055 pub TfLiteOpaqueContextGetExecutionPlan: Result<
2056 unsafe extern "C" fn(
2057 opaque_context: *mut TfLiteOpaqueContext,
2058 execution_plan: *mut *mut TfLiteIntArray,
2059 ) -> TfLiteStatus,
2060 ::libloading::Error,
2061 >,
2062 pub TfLiteOpaqueContextGetExternalContext: Result<
2063 unsafe extern "C" fn(
2064 opaque_context: *mut TfLiteOpaqueContext,
2065 external_context: *mut *mut ::std::os::raw::c_void,
2066 type_: TfLiteExternalContextType,
2067 ) -> TfLiteStatus,
2068 ::libloading::Error,
2069 >,
2070 pub TfLiteOpaqueContextGetNodeAndRegistration: Result<
2071 unsafe extern "C" fn(
2072 opaque_context: *mut TfLiteOpaqueContext,
2073 node_index: ::std::os::raw::c_int,
2074 node: *mut *mut TfLiteOpaqueNode,
2075 registration_external: *mut *mut TfLiteOperator,
2076 ) -> TfLiteStatus,
2077 ::libloading::Error,
2078 >,
2079 pub TfLiteOpaqueContextReplaceNodeSubsetsWithDelegateKernels: Result<
2080 unsafe extern "C" fn(
2081 opaque_context: *mut TfLiteOpaqueContext,
2082 registration_external: *mut TfLiteOperator,
2083 nodes_to_replace: *const TfLiteIntArray,
2084 opaque_delegate: *mut TfLiteOpaqueDelegate,
2085 ) -> TfLiteStatus,
2086 ::libloading::Error,
2087 >,
2088 pub TfLiteOpaqueContextGetOpaqueTensor: Result<
2089 unsafe extern "C" fn(
2090 opaque_context: *const TfLiteOpaqueContext,
2091 index: ::std::os::raw::c_int,
2092 ) -> *mut TfLiteOpaqueTensor,
2093 ::libloading::Error,
2094 >,
2095 pub TfLiteOpaqueContextGetInputs: Result<
2096 unsafe extern "C" fn(
2097 opaque_context: *const TfLiteOpaqueContext,
2098 inputs: *mut *const ::std::os::raw::c_int,
2099 num_inputs: *mut ::std::os::raw::c_int,
2100 ) -> TfLiteStatus,
2101 ::libloading::Error,
2102 >,
2103 pub TfLiteOpaqueContextGetOutputs: Result<
2104 unsafe extern "C" fn(
2105 opaque_context: *const TfLiteOpaqueContext,
2106 outputs: *mut *const ::std::os::raw::c_int,
2107 num_outputs: *mut ::std::os::raw::c_int,
2108 ) -> TfLiteStatus,
2109 ::libloading::Error,
2110 >,
2111 pub TfLiteOpaqueContextGetVariables: Result<
2112 unsafe extern "C" fn(
2113 opaque_context: *const TfLiteOpaqueContext,
2114 variables: *mut *const ::std::os::raw::c_int,
2115 num_variables: *mut ::std::os::raw::c_int,
2116 ) -> TfLiteStatus,
2117 ::libloading::Error,
2118 >,
2119 pub TfLiteOpaqueContextGetNumNodes: Result<
2120 unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext) -> usize,
2121 ::libloading::Error,
2122 >,
2123 pub TfLiteOpaqueContextGetNumTensors: Result<
2124 unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext) -> usize,
2125 ::libloading::Error,
2126 >,
2127 pub TfLiteOpaqueContextGetName: Result<
2128 unsafe extern "C" fn(
2129 opaque_context: *const TfLiteOpaqueContext,
2130 ) -> *const ::std::os::raw::c_char,
2131 ::libloading::Error,
2132 >,
2133 pub TfLiteOpaqueContextResizeTensor: Result<
2134 unsafe extern "C" fn(
2135 context: *mut TfLiteOpaqueContext,
2136 tensor: *mut TfLiteOpaqueTensor,
2137 new_size: *mut TfLiteIntArray,
2138 ) -> TfLiteStatus,
2139 ::libloading::Error,
2140 >,
2141 pub TfLiteOpaqueContextAcquireSubgraphContext: Result<
2142 unsafe extern "C" fn(
2143 opaque_context: *mut TfLiteOpaqueContext,
2144 subgraph_index: ::std::os::raw::c_int,
2145 acquired_opaque_context: *mut *mut TfLiteOpaqueContext,
2146 ) -> TfLiteStatus,
2147 ::libloading::Error,
2148 >,
2149 pub TfLiteOpaqueContextReleaseSubgraphContext: Result<
2150 unsafe extern "C" fn(
2151 opaque_context: *mut TfLiteOpaqueContext,
2152 subgraph_index: ::std::os::raw::c_int,
2153 ) -> TfLiteStatus,
2154 ::libloading::Error,
2155 >,
2156 pub TfLiteOpaqueContextMarkSubgraphAsDelegationSkippable: Result<
2157 unsafe extern "C" fn(
2158 opaque_context: *mut TfLiteOpaqueContext,
2159 subgraph_index: ::std::os::raw::c_int,
2160 ) -> TfLiteStatus,
2161 ::libloading::Error,
2162 >,
2163 pub TfLiteOpaqueContextGetNodeInitDataMmapInfo: Result<
2164 unsafe extern "C" fn(
2165 context: *const TfLiteOpaqueContext,
2166 node: *const TfLiteOpaqueNode,
2167 fd: *mut ::std::os::raw::c_int,
2168 custom_initial_data_offset_in_file: *mut i64,
2169 custom_initial_data_size: *mut i64,
2170 ) -> TfLiteStatus,
2171 ::libloading::Error,
2172 >,
2173 pub TfLiteOpaqueContextAddTensor: Result<
2174 unsafe extern "C" fn(
2175 context: *mut TfLiteOpaqueContext,
2176 builder: *mut TfLiteOpaqueTensorBuilder,
2177 new_tensor_index: *mut ::std::os::raw::c_int,
2178 ) -> TfLiteStatus,
2179 ::libloading::Error,
2180 >,
2181 pub TfLiteOpaqueContextGetSizeOfType: Result<
2182 unsafe extern "C" fn(
2183 context: *mut TfLiteOpaqueContext,
2184 type_: TfLiteType,
2185 bytes: *mut usize,
2186 ) -> TfLiteStatus,
2187 ::libloading::Error,
2188 >,
2189 pub TfLiteOpaqueContextGetMetadata: Result<
2190 unsafe extern "C" fn(
2191 context: *mut TfLiteOpaqueContext,
2192 name: *const ::std::os::raw::c_char,
2193 ptr: *mut *const ::std::os::raw::c_char,
2194 bytes: *mut usize,
2195 ) -> TfLiteStatus,
2196 ::libloading::Error,
2197 >,
2198 pub TfLiteOpaqueContextReportError: Result<
2199 unsafe extern "C" fn(
2200 opaque_context: *mut TfLiteOpaqueContext,
2201 format: *const ::std::os::raw::c_char,
2202 ...
2203 ),
2204 ::libloading::Error,
2205 >,
2206 pub TfLiteOpaqueContextReportErrorVa: Result<
2207 unsafe extern "C" fn(
2208 opaque_context: *mut TfLiteOpaqueContext,
2209 format: *const ::std::os::raw::c_char,
2210 vlist: *mut __va_list_tag,
2211 ),
2212 ::libloading::Error,
2213 >,
2214}
2215impl tensorflowlite_c {
2216 pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
2217 where
2218 P: AsRef<::std::ffi::OsStr>,
2219 {
2220 let library = unsafe { ::libloading::Library::new(path) }?;
2221 unsafe { Self::from_library(library) }
2222 }
2223
2224 pub unsafe fn from_library<L>(library: L) -> Result<Self, ::libloading::Error>
2225 where
2226 L: Into<::libloading::Library>,
2227 {
2228 let __library = library.into();
2229 let TfLiteOperatorCreate =
2230 unsafe { __library.get(b"TfLiteOperatorCreate\0") }.map(|sym| *sym);
2231 let TfLiteOperatorDelete =
2232 unsafe { __library.get(b"TfLiteOperatorDelete\0") }.map(|sym| *sym);
2233 let TfLiteOperatorGetBuiltInCode =
2234 unsafe { __library.get(b"TfLiteOperatorGetBuiltInCode\0") }.map(|sym| *sym);
2235 let TfLiteOperatorGetCustomName =
2236 unsafe { __library.get(b"TfLiteOperatorGetCustomName\0") }.map(|sym| *sym);
2237 let TfLiteOperatorGetVersion =
2238 unsafe { __library.get(b"TfLiteOperatorGetVersion\0") }.map(|sym| *sym);
2239 let TfLiteOperatorGetUserData =
2240 unsafe { __library.get(b"TfLiteOperatorGetUserData\0") }.map(|sym| *sym);
2241 let TfLiteOperatorSetInit =
2242 unsafe { __library.get(b"TfLiteOperatorSetInit\0") }.map(|sym| *sym);
2243 let TfLiteOperatorSetInitWithData =
2244 unsafe { __library.get(b"TfLiteOperatorSetInitWithData\0") }.map(|sym| *sym);
2245 let TfLiteOperatorSetFree =
2246 unsafe { __library.get(b"TfLiteOperatorSetFree\0") }.map(|sym| *sym);
2247 let TfLiteOperatorSetFreeWithData =
2248 unsafe { __library.get(b"TfLiteOperatorSetFreeWithData\0") }.map(|sym| *sym);
2249 let TfLiteOperatorSetPrepare =
2250 unsafe { __library.get(b"TfLiteOperatorSetPrepare\0") }.map(|sym| *sym);
2251 let TfLiteOperatorSetPrepareWithData =
2252 unsafe { __library.get(b"TfLiteOperatorSetPrepareWithData\0") }.map(|sym| *sym);
2253 let TfLiteOperatorSetInvoke =
2254 unsafe { __library.get(b"TfLiteOperatorSetInvoke\0") }.map(|sym| *sym);
2255 let TfLiteOperatorSetInvokeWithData =
2256 unsafe { __library.get(b"TfLiteOperatorSetInvokeWithData\0") }.map(|sym| *sym);
2257 let TfLiteOperatorSetAsyncKernel =
2258 unsafe { __library.get(b"TfLiteOperatorSetAsyncKernel\0") }.map(|sym| *sym);
2259 let TfLiteOperatorSetAsyncKernelWithData =
2260 unsafe { __library.get(b"TfLiteOperatorSetAsyncKernelWithData\0") }.map(|sym| *sym);
2261 let TfLiteOperatorSetInplaceOperator =
2262 unsafe { __library.get(b"TfLiteOperatorSetInplaceOperator\0") }.map(|sym| *sym);
2263 let TfLiteVersion = unsafe { __library.get(b"TfLiteVersion\0") }.map(|sym| *sym);
2264 let TfLiteExtensionApisVersion =
2265 unsafe { __library.get(b"TfLiteExtensionApisVersion\0") }.map(|sym| *sym);
2266 let TfLiteSchemaVersion =
2267 unsafe { __library.get(b"TfLiteSchemaVersion\0") }.map(|sym| *sym);
2268 let TfLiteModelCreate = unsafe { __library.get(b"TfLiteModelCreate\0") }.map(|sym| *sym);
2269 let TfLiteModelCreateWithErrorReporter =
2270 unsafe { __library.get(b"TfLiteModelCreateWithErrorReporter\0") }.map(|sym| *sym);
2271 let TfLiteModelCreateFromFile =
2272 unsafe { __library.get(b"TfLiteModelCreateFromFile\0") }.map(|sym| *sym);
2273 let TfLiteModelCreateFromFileWithErrorReporter =
2274 unsafe { __library.get(b"TfLiteModelCreateFromFileWithErrorReporter\0") }
2275 .map(|sym| *sym);
2276 let TfLiteModelDelete = unsafe { __library.get(b"TfLiteModelDelete\0") }.map(|sym| *sym);
2277 let TfLiteInterpreterOptionsCreate =
2278 unsafe { __library.get(b"TfLiteInterpreterOptionsCreate\0") }.map(|sym| *sym);
2279 let TfLiteInterpreterOptionsCopy =
2280 unsafe { __library.get(b"TfLiteInterpreterOptionsCopy\0") }.map(|sym| *sym);
2281 let TfLiteInterpreterOptionsDelete =
2282 unsafe { __library.get(b"TfLiteInterpreterOptionsDelete\0") }.map(|sym| *sym);
2283 let TfLiteInterpreterOptionsSetNumThreads =
2284 unsafe { __library.get(b"TfLiteInterpreterOptionsSetNumThreads\0") }.map(|sym| *sym);
2285 let TfLiteInterpreterOptionsAddDelegate =
2286 unsafe { __library.get(b"TfLiteInterpreterOptionsAddDelegate\0") }.map(|sym| *sym);
2287 let TfLiteInterpreterOptionsSetErrorReporter =
2288 unsafe { __library.get(b"TfLiteInterpreterOptionsSetErrorReporter\0") }.map(|sym| *sym);
2289 let TfLiteInterpreterOptionsAddOperator =
2290 unsafe { __library.get(b"TfLiteInterpreterOptionsAddOperator\0") }.map(|sym| *sym);
2291 let TfLiteInterpreterOptionsEnableCancellation =
2292 unsafe { __library.get(b"TfLiteInterpreterOptionsEnableCancellation\0") }
2293 .map(|sym| *sym);
2294 let TfLiteInterpreterCreate =
2295 unsafe { __library.get(b"TfLiteInterpreterCreate\0") }.map(|sym| *sym);
2296 let TfLiteInterpreterDelete =
2297 unsafe { __library.get(b"TfLiteInterpreterDelete\0") }.map(|sym| *sym);
2298 let TfLiteInterpreterGetInputTensorCount =
2299 unsafe { __library.get(b"TfLiteInterpreterGetInputTensorCount\0") }.map(|sym| *sym);
2300 let TfLiteInterpreterInputTensorIndices =
2301 unsafe { __library.get(b"TfLiteInterpreterInputTensorIndices\0") }.map(|sym| *sym);
2302 let TfLiteInterpreterGetInputTensor =
2303 unsafe { __library.get(b"TfLiteInterpreterGetInputTensor\0") }.map(|sym| *sym);
2304 let TfLiteInterpreterResizeInputTensor =
2305 unsafe { __library.get(b"TfLiteInterpreterResizeInputTensor\0") }.map(|sym| *sym);
2306 let TfLiteInterpreterAllocateTensors =
2307 unsafe { __library.get(b"TfLiteInterpreterAllocateTensors\0") }.map(|sym| *sym);
2308 let TfLiteInterpreterInvoke =
2309 unsafe { __library.get(b"TfLiteInterpreterInvoke\0") }.map(|sym| *sym);
2310 let TfLiteInterpreterGetOutputTensorCount =
2311 unsafe { __library.get(b"TfLiteInterpreterGetOutputTensorCount\0") }.map(|sym| *sym);
2312 let TfLiteInterpreterOutputTensorIndices =
2313 unsafe { __library.get(b"TfLiteInterpreterOutputTensorIndices\0") }.map(|sym| *sym);
2314 let TfLiteInterpreterGetOutputTensor =
2315 unsafe { __library.get(b"TfLiteInterpreterGetOutputTensor\0") }.map(|sym| *sym);
2316 let TfLiteInterpreterGetTensor =
2317 unsafe { __library.get(b"TfLiteInterpreterGetTensor\0") }.map(|sym| *sym);
2318 let TfLiteInterpreterCancel =
2319 unsafe { __library.get(b"TfLiteInterpreterCancel\0") }.map(|sym| *sym);
2320 let TfLiteInterpreterGetSignatureCount =
2321 unsafe { __library.get(b"TfLiteInterpreterGetSignatureCount\0") }.map(|sym| *sym);
2322 let TfLiteInterpreterGetSignatureKey =
2323 unsafe { __library.get(b"TfLiteInterpreterGetSignatureKey\0") }.map(|sym| *sym);
2324 let TfLiteInterpreterGetSignatureRunner =
2325 unsafe { __library.get(b"TfLiteInterpreterGetSignatureRunner\0") }.map(|sym| *sym);
2326 let TfLiteSignatureRunnerGetInputCount =
2327 unsafe { __library.get(b"TfLiteSignatureRunnerGetInputCount\0") }.map(|sym| *sym);
2328 let TfLiteSignatureRunnerGetInputName =
2329 unsafe { __library.get(b"TfLiteSignatureRunnerGetInputName\0") }.map(|sym| *sym);
2330 let TfLiteSignatureRunnerResizeInputTensor =
2331 unsafe { __library.get(b"TfLiteSignatureRunnerResizeInputTensor\0") }.map(|sym| *sym);
2332 let TfLiteSignatureRunnerAllocateTensors =
2333 unsafe { __library.get(b"TfLiteSignatureRunnerAllocateTensors\0") }.map(|sym| *sym);
2334 let TfLiteSignatureRunnerGetInputTensor =
2335 unsafe { __library.get(b"TfLiteSignatureRunnerGetInputTensor\0") }.map(|sym| *sym);
2336 let TfLiteSignatureRunnerInvoke =
2337 unsafe { __library.get(b"TfLiteSignatureRunnerInvoke\0") }.map(|sym| *sym);
2338 let TfLiteSignatureRunnerGetOutputCount =
2339 unsafe { __library.get(b"TfLiteSignatureRunnerGetOutputCount\0") }.map(|sym| *sym);
2340 let TfLiteSignatureRunnerGetOutputName =
2341 unsafe { __library.get(b"TfLiteSignatureRunnerGetOutputName\0") }.map(|sym| *sym);
2342 let TfLiteSignatureRunnerGetOutputTensor =
2343 unsafe { __library.get(b"TfLiteSignatureRunnerGetOutputTensor\0") }.map(|sym| *sym);
2344 let TfLiteTensorType = unsafe { __library.get(b"TfLiteTensorType\0") }.map(|sym| *sym);
2345 let TfLiteTensorNumDims =
2346 unsafe { __library.get(b"TfLiteTensorNumDims\0") }.map(|sym| *sym);
2347 let TfLiteTensorDim = unsafe { __library.get(b"TfLiteTensorDim\0") }.map(|sym| *sym);
2348 let TfLiteTensorByteSize =
2349 unsafe { __library.get(b"TfLiteTensorByteSize\0") }.map(|sym| *sym);
2350 let TfLiteTensorData = unsafe { __library.get(b"TfLiteTensorData\0") }.map(|sym| *sym);
2351 let TfLiteTensorName = unsafe { __library.get(b"TfLiteTensorName\0") }.map(|sym| *sym);
2352 let TfLiteTensorQuantizationParams =
2353 unsafe { __library.get(b"TfLiteTensorQuantizationParams\0") }.map(|sym| *sym);
2354 let TfLiteTensorCopyFromBuffer =
2355 unsafe { __library.get(b"TfLiteTensorCopyFromBuffer\0") }.map(|sym| *sym);
2356 let TfLiteTensorCopyToBuffer =
2357 unsafe { __library.get(b"TfLiteTensorCopyToBuffer\0") }.map(|sym| *sym);
2358 let TfLiteSignatureRunnerDelete =
2359 unsafe { __library.get(b"TfLiteSignatureRunnerDelete\0") }.map(|sym| *sym);
2360 let TfLiteIntArrayGetSizeInBytes =
2361 unsafe { __library.get(b"TfLiteIntArrayGetSizeInBytes\0") }.map(|sym| *sym);
2362 let TfLiteIntArrayCreate =
2363 unsafe { __library.get(b"TfLiteIntArrayCreate\0") }.map(|sym| *sym);
2364 let TfLiteIntArrayEqual =
2365 unsafe { __library.get(b"TfLiteIntArrayEqual\0") }.map(|sym| *sym);
2366 let TfLiteIntArrayEqualsArray =
2367 unsafe { __library.get(b"TfLiteIntArrayEqualsArray\0") }.map(|sym| *sym);
2368 let TfLiteIntArrayCopy = unsafe { __library.get(b"TfLiteIntArrayCopy\0") }.map(|sym| *sym);
2369 let TfLiteIntArrayFree = unsafe { __library.get(b"TfLiteIntArrayFree\0") }.map(|sym| *sym);
2370 let TfLiteFloatArrayGetSizeInBytes =
2371 unsafe { __library.get(b"TfLiteFloatArrayGetSizeInBytes\0") }.map(|sym| *sym);
2372 let TfLiteFloatArrayCreate =
2373 unsafe { __library.get(b"TfLiteFloatArrayCreate\0") }.map(|sym| *sym);
2374 let TfLiteFloatArrayCopy =
2375 unsafe { __library.get(b"TfLiteFloatArrayCopy\0") }.map(|sym| *sym);
2376 let TfLiteFloatArrayFree =
2377 unsafe { __library.get(b"TfLiteFloatArrayFree\0") }.map(|sym| *sym);
2378 let TfLiteTypeGetName = unsafe { __library.get(b"TfLiteTypeGetName\0") }.map(|sym| *sym);
2379 let TfLiteTensorDataFree =
2380 unsafe { __library.get(b"TfLiteTensorDataFree\0") }.map(|sym| *sym);
2381 let TfLiteQuantizationFree =
2382 unsafe { __library.get(b"TfLiteQuantizationFree\0") }.map(|sym| *sym);
2383 let TfLiteSparsityFree = unsafe { __library.get(b"TfLiteSparsityFree\0") }.map(|sym| *sym);
2384 let TfLiteTensorFree = unsafe { __library.get(b"TfLiteTensorFree\0") }.map(|sym| *sym);
2385 let TfLiteTensorReset = unsafe { __library.get(b"TfLiteTensorReset\0") }.map(|sym| *sym);
2386 let TfLiteTensorCopy = unsafe { __library.get(b"TfLiteTensorCopy\0") }.map(|sym| *sym);
2387 let TfLiteTensorResizeMaybeCopy =
2388 unsafe { __library.get(b"TfLiteTensorResizeMaybeCopy\0") }.map(|sym| *sym);
2389 let TfLiteTensorRealloc =
2390 unsafe { __library.get(b"TfLiteTensorRealloc\0") }.map(|sym| *sym);
2391 let TfLiteDelegateCreate =
2392 unsafe { __library.get(b"TfLiteDelegateCreate\0") }.map(|sym| *sym);
2393 let TfLiteOpaqueDelegateCreate =
2394 unsafe { __library.get(b"TfLiteOpaqueDelegateCreate\0") }.map(|sym| *sym);
2395 let TfLiteOpaqueDelegateDelete =
2396 unsafe { __library.get(b"TfLiteOpaqueDelegateDelete\0") }.map(|sym| *sym);
2397 let TfLiteOpaqueDelegateGetData =
2398 unsafe { __library.get(b"TfLiteOpaqueDelegateGetData\0") }.map(|sym| *sym);
2399 let TfLiteTensorGetAllocationStrategy =
2400 unsafe { __library.get(b"TfLiteTensorGetAllocationStrategy\0") }.map(|sym| *sym);
2401 let TfLiteTensorGetBufferAddressStability =
2402 unsafe { __library.get(b"TfLiteTensorGetBufferAddressStability\0") }.map(|sym| *sym);
2403 let TfLiteTensorGetDataStability =
2404 unsafe { __library.get(b"TfLiteTensorGetDataStability\0") }.map(|sym| *sym);
2405 let TfLiteTensorGetDataKnownStep =
2406 unsafe { __library.get(b"TfLiteTensorGetDataKnownStep\0") }.map(|sym| *sym);
2407 let TfLiteTensorGetShapeKnownStep =
2408 unsafe { __library.get(b"TfLiteTensorGetShapeKnownStep\0") }.map(|sym| *sym);
2409 let TfLiteOpaqueTensorType =
2410 unsafe { __library.get(b"TfLiteOpaqueTensorType\0") }.map(|sym| *sym);
2411 let TfLiteOpaqueTensorNumDims =
2412 unsafe { __library.get(b"TfLiteOpaqueTensorNumDims\0") }.map(|sym| *sym);
2413 let TfLiteOpaqueTensorDim =
2414 unsafe { __library.get(b"TfLiteOpaqueTensorDim\0") }.map(|sym| *sym);
2415 let TfLiteOpaqueTensorGetNumDimsSignature =
2416 unsafe { __library.get(b"TfLiteOpaqueTensorGetNumDimsSignature\0") }.map(|sym| *sym);
2417 let TfLiteOpaqueTensorGetDimSignature =
2418 unsafe { __library.get(b"TfLiteOpaqueTensorGetDimSignature\0") }.map(|sym| *sym);
2419 let TfLiteOpaqueTensorIsVariable =
2420 unsafe { __library.get(b"TfLiteOpaqueTensorIsVariable\0") }.map(|sym| *sym);
2421 let TfLiteOpaqueTensorByteSize =
2422 unsafe { __library.get(b"TfLiteOpaqueTensorByteSize\0") }.map(|sym| *sym);
2423 let TfLiteOpaqueTensorData =
2424 unsafe { __library.get(b"TfLiteOpaqueTensorData\0") }.map(|sym| *sym);
2425 let TfLiteOpaqueTensorGetAllocationType =
2426 unsafe { __library.get(b"TfLiteOpaqueTensorGetAllocationType\0") }.map(|sym| *sym);
2427 let TfLiteOpaqueTensorGetAllocationStrategy =
2428 unsafe { __library.get(b"TfLiteOpaqueTensorGetAllocationStrategy\0") }.map(|sym| *sym);
2429 let TfLiteOpaqueTensorGetBufferAddressStability =
2430 unsafe { __library.get(b"TfLiteOpaqueTensorGetBufferAddressStability\0") }
2431 .map(|sym| *sym);
2432 let TfLiteOpaqueTensorGetDataStability =
2433 unsafe { __library.get(b"TfLiteOpaqueTensorGetDataStability\0") }.map(|sym| *sym);
2434 let TfLiteOpaqueTensorGetDataKnownStep =
2435 unsafe { __library.get(b"TfLiteOpaqueTensorGetDataKnownStep\0") }.map(|sym| *sym);
2436 let TfLiteOpaqueTensorGetShapeKnownStep =
2437 unsafe { __library.get(b"TfLiteOpaqueTensorGetShapeKnownStep\0") }.map(|sym| *sym);
2438 let TfLiteOpaqueTensorName =
2439 unsafe { __library.get(b"TfLiteOpaqueTensorName\0") }.map(|sym| *sym);
2440 let TfLiteOpaqueTensorGetQuantization =
2441 unsafe { __library.get(b"TfLiteOpaqueTensorGetQuantization\0") }.map(|sym| *sym);
2442 let TfLiteOpaqueTensorGetQuantizationParams =
2443 unsafe { __library.get(b"TfLiteOpaqueTensorGetQuantizationParams\0") }.map(|sym| *sym);
2444 let TfLiteOpaqueTensorCopyFromBuffer =
2445 unsafe { __library.get(b"TfLiteOpaqueTensorCopyFromBuffer\0") }.map(|sym| *sym);
2446 let TfLiteOpaqueTensorCopyToBuffer =
2447 unsafe { __library.get(b"TfLiteOpaqueTensorCopyToBuffer\0") }.map(|sym| *sym);
2448 let TfLiteOpaqueTensorGetStringCount =
2449 unsafe { __library.get(b"TfLiteOpaqueTensorGetStringCount\0") }.map(|sym| *sym);
2450 let TfLiteOpaqueTensorGetString =
2451 unsafe { __library.get(b"TfLiteOpaqueTensorGetString\0") }.map(|sym| *sym);
2452 let TfLiteOpaqueTensorWriteStrings =
2453 unsafe { __library.get(b"TfLiteOpaqueTensorWriteStrings\0") }.map(|sym| *sym);
2454 let TfLiteOpaqueTensorWriteString =
2455 unsafe { __library.get(b"TfLiteOpaqueTensorWriteString\0") }.map(|sym| *sym);
2456 let TfLiteOpaqueTensorBuilderCreate =
2457 unsafe { __library.get(b"TfLiteOpaqueTensorBuilderCreate\0") }.map(|sym| *sym);
2458 let TfLiteOpaqueTensorBuilderDelete =
2459 unsafe { __library.get(b"TfLiteOpaqueTensorBuilderDelete\0") }.map(|sym| *sym);
2460 let TfLiteOpaqueTensorBuilderSetType =
2461 unsafe { __library.get(b"TfLiteOpaqueTensorBuilderSetType\0") }.map(|sym| *sym);
2462 let TfLiteOpaqueTensorBuilderSetData =
2463 unsafe { __library.get(b"TfLiteOpaqueTensorBuilderSetData\0") }.map(|sym| *sym);
2464 let TfLiteOpaqueTensorBuilderSetAllocationType =
2465 unsafe { __library.get(b"TfLiteOpaqueTensorBuilderSetAllocationType\0") }
2466 .map(|sym| *sym);
2467 let TfLiteOpaqueTensorBuilderSetQuantizationParams =
2468 unsafe { __library.get(b"TfLiteOpaqueTensorBuilderSetQuantizationParams\0") }
2469 .map(|sym| *sym);
2470 let TfLiteOpaqueTensorBuilderSetQuantization =
2471 unsafe { __library.get(b"TfLiteOpaqueTensorBuilderSetQuantization\0") }.map(|sym| *sym);
2472 let TfLiteOpaqueTensorSetAllocationTypeToDynamic =
2473 unsafe { __library.get(b"TfLiteOpaqueTensorSetAllocationTypeToDynamic\0") }
2474 .map(|sym| *sym);
2475 let TfLiteOpaqueNodeGetInput =
2476 unsafe { __library.get(b"TfLiteOpaqueNodeGetInput\0") }.map(|sym| *sym);
2477 let TfLiteOpaqueNodeGetOutput =
2478 unsafe { __library.get(b"TfLiteOpaqueNodeGetOutput\0") }.map(|sym| *sym);
2479 let TfLiteOpaqueNodeNumberOfInputs =
2480 unsafe { __library.get(b"TfLiteOpaqueNodeNumberOfInputs\0") }.map(|sym| *sym);
2481 let TfLiteOpaqueNodeNumberOfOutputs =
2482 unsafe { __library.get(b"TfLiteOpaqueNodeNumberOfOutputs\0") }.map(|sym| *sym);
2483 let TfLiteOpaqueNodeGetUserData =
2484 unsafe { __library.get(b"TfLiteOpaqueNodeGetUserData\0") }.map(|sym| *sym);
2485 let TfLiteOpaqueNodeGetBuiltinData =
2486 unsafe { __library.get(b"TfLiteOpaqueNodeGetBuiltinData\0") }.map(|sym| *sym);
2487 let TfLiteOpaqueNodeGetCustomInitialData =
2488 unsafe { __library.get(b"TfLiteOpaqueNodeGetCustomInitialData\0") }.map(|sym| *sym);
2489 let TfLiteOpaqueNodeInputs =
2490 unsafe { __library.get(b"TfLiteOpaqueNodeInputs\0") }.map(|sym| *sym);
2491 let TfLiteOpaqueNodeOutputs =
2492 unsafe { __library.get(b"TfLiteOpaqueNodeOutputs\0") }.map(|sym| *sym);
2493 let TfLiteOpaqueNodeSetTemporaries =
2494 unsafe { __library.get(b"TfLiteOpaqueNodeSetTemporaries\0") }.map(|sym| *sym);
2495 let TfLiteOpaqueNodeTemporaries =
2496 unsafe { __library.get(b"TfLiteOpaqueNodeTemporaries\0") }.map(|sym| *sym);
2497 let TfLiteOpaqueNodeGetInputTensorIndex =
2498 unsafe { __library.get(b"TfLiteOpaqueNodeGetInputTensorIndex\0") }.map(|sym| *sym);
2499 let TfLiteOpaqueNodeGetOutputTensorIndex =
2500 unsafe { __library.get(b"TfLiteOpaqueNodeGetOutputTensorIndex\0") }.map(|sym| *sym);
2501 let TfLiteOpaqueContextGetExecutionPlan =
2502 unsafe { __library.get(b"TfLiteOpaqueContextGetExecutionPlan\0") }.map(|sym| *sym);
2503 let TfLiteOpaqueContextGetExternalContext =
2504 unsafe { __library.get(b"TfLiteOpaqueContextGetExternalContext\0") }.map(|sym| *sym);
2505 let TfLiteOpaqueContextGetNodeAndRegistration =
2506 unsafe { __library.get(b"TfLiteOpaqueContextGetNodeAndRegistration\0") }
2507 .map(|sym| *sym);
2508 let TfLiteOpaqueContextReplaceNodeSubsetsWithDelegateKernels =
2509 unsafe { __library.get(b"TfLiteOpaqueContextReplaceNodeSubsetsWithDelegateKernels\0") }
2510 .map(|sym| *sym);
2511 let TfLiteOpaqueContextGetOpaqueTensor =
2512 unsafe { __library.get(b"TfLiteOpaqueContextGetOpaqueTensor\0") }.map(|sym| *sym);
2513 let TfLiteOpaqueContextGetInputs =
2514 unsafe { __library.get(b"TfLiteOpaqueContextGetInputs\0") }.map(|sym| *sym);
2515 let TfLiteOpaqueContextGetOutputs =
2516 unsafe { __library.get(b"TfLiteOpaqueContextGetOutputs\0") }.map(|sym| *sym);
2517 let TfLiteOpaqueContextGetVariables =
2518 unsafe { __library.get(b"TfLiteOpaqueContextGetVariables\0") }.map(|sym| *sym);
2519 let TfLiteOpaqueContextGetNumNodes =
2520 unsafe { __library.get(b"TfLiteOpaqueContextGetNumNodes\0") }.map(|sym| *sym);
2521 let TfLiteOpaqueContextGetNumTensors =
2522 unsafe { __library.get(b"TfLiteOpaqueContextGetNumTensors\0") }.map(|sym| *sym);
2523 let TfLiteOpaqueContextGetName =
2524 unsafe { __library.get(b"TfLiteOpaqueContextGetName\0") }.map(|sym| *sym);
2525 let TfLiteOpaqueContextResizeTensor =
2526 unsafe { __library.get(b"TfLiteOpaqueContextResizeTensor\0") }.map(|sym| *sym);
2527 let TfLiteOpaqueContextAcquireSubgraphContext =
2528 unsafe { __library.get(b"TfLiteOpaqueContextAcquireSubgraphContext\0") }
2529 .map(|sym| *sym);
2530 let TfLiteOpaqueContextReleaseSubgraphContext =
2531 unsafe { __library.get(b"TfLiteOpaqueContextReleaseSubgraphContext\0") }
2532 .map(|sym| *sym);
2533 let TfLiteOpaqueContextMarkSubgraphAsDelegationSkippable =
2534 unsafe { __library.get(b"TfLiteOpaqueContextMarkSubgraphAsDelegationSkippable\0") }
2535 .map(|sym| *sym);
2536 let TfLiteOpaqueContextGetNodeInitDataMmapInfo =
2537 unsafe { __library.get(b"TfLiteOpaqueContextGetNodeInitDataMmapInfo\0") }
2538 .map(|sym| *sym);
2539 let TfLiteOpaqueContextAddTensor =
2540 unsafe { __library.get(b"TfLiteOpaqueContextAddTensor\0") }.map(|sym| *sym);
2541 let TfLiteOpaqueContextGetSizeOfType =
2542 unsafe { __library.get(b"TfLiteOpaqueContextGetSizeOfType\0") }.map(|sym| *sym);
2543 let TfLiteOpaqueContextGetMetadata =
2544 unsafe { __library.get(b"TfLiteOpaqueContextGetMetadata\0") }.map(|sym| *sym);
2545 let TfLiteOpaqueContextReportError =
2546 unsafe { __library.get(b"TfLiteOpaqueContextReportError\0") }.map(|sym| *sym);
2547 let TfLiteOpaqueContextReportErrorVa =
2548 unsafe { __library.get(b"TfLiteOpaqueContextReportErrorVa\0") }.map(|sym| *sym);
2549 Ok(tensorflowlite_c {
2550 __library,
2551 TfLiteOperatorCreate,
2552 TfLiteOperatorDelete,
2553 TfLiteOperatorGetBuiltInCode,
2554 TfLiteOperatorGetCustomName,
2555 TfLiteOperatorGetVersion,
2556 TfLiteOperatorGetUserData,
2557 TfLiteOperatorSetInit,
2558 TfLiteOperatorSetInitWithData,
2559 TfLiteOperatorSetFree,
2560 TfLiteOperatorSetFreeWithData,
2561 TfLiteOperatorSetPrepare,
2562 TfLiteOperatorSetPrepareWithData,
2563 TfLiteOperatorSetInvoke,
2564 TfLiteOperatorSetInvokeWithData,
2565 TfLiteOperatorSetAsyncKernel,
2566 TfLiteOperatorSetAsyncKernelWithData,
2567 TfLiteOperatorSetInplaceOperator,
2568 TfLiteVersion,
2569 TfLiteExtensionApisVersion,
2570 TfLiteSchemaVersion,
2571 TfLiteModelCreate,
2572 TfLiteModelCreateWithErrorReporter,
2573 TfLiteModelCreateFromFile,
2574 TfLiteModelCreateFromFileWithErrorReporter,
2575 TfLiteModelDelete,
2576 TfLiteInterpreterOptionsCreate,
2577 TfLiteInterpreterOptionsCopy,
2578 TfLiteInterpreterOptionsDelete,
2579 TfLiteInterpreterOptionsSetNumThreads,
2580 TfLiteInterpreterOptionsAddDelegate,
2581 TfLiteInterpreterOptionsSetErrorReporter,
2582 TfLiteInterpreterOptionsAddOperator,
2583 TfLiteInterpreterOptionsEnableCancellation,
2584 TfLiteInterpreterCreate,
2585 TfLiteInterpreterDelete,
2586 TfLiteInterpreterGetInputTensorCount,
2587 TfLiteInterpreterInputTensorIndices,
2588 TfLiteInterpreterGetInputTensor,
2589 TfLiteInterpreterResizeInputTensor,
2590 TfLiteInterpreterAllocateTensors,
2591 TfLiteInterpreterInvoke,
2592 TfLiteInterpreterGetOutputTensorCount,
2593 TfLiteInterpreterOutputTensorIndices,
2594 TfLiteInterpreterGetOutputTensor,
2595 TfLiteInterpreterGetTensor,
2596 TfLiteInterpreterCancel,
2597 TfLiteInterpreterGetSignatureCount,
2598 TfLiteInterpreterGetSignatureKey,
2599 TfLiteInterpreterGetSignatureRunner,
2600 TfLiteSignatureRunnerGetInputCount,
2601 TfLiteSignatureRunnerGetInputName,
2602 TfLiteSignatureRunnerResizeInputTensor,
2603 TfLiteSignatureRunnerAllocateTensors,
2604 TfLiteSignatureRunnerGetInputTensor,
2605 TfLiteSignatureRunnerInvoke,
2606 TfLiteSignatureRunnerGetOutputCount,
2607 TfLiteSignatureRunnerGetOutputName,
2608 TfLiteSignatureRunnerGetOutputTensor,
2609 TfLiteTensorType,
2610 TfLiteTensorNumDims,
2611 TfLiteTensorDim,
2612 TfLiteTensorByteSize,
2613 TfLiteTensorData,
2614 TfLiteTensorName,
2615 TfLiteTensorQuantizationParams,
2616 TfLiteTensorCopyFromBuffer,
2617 TfLiteTensorCopyToBuffer,
2618 TfLiteSignatureRunnerDelete,
2619 TfLiteIntArrayGetSizeInBytes,
2620 TfLiteIntArrayCreate,
2621 TfLiteIntArrayEqual,
2622 TfLiteIntArrayEqualsArray,
2623 TfLiteIntArrayCopy,
2624 TfLiteIntArrayFree,
2625 TfLiteFloatArrayGetSizeInBytes,
2626 TfLiteFloatArrayCreate,
2627 TfLiteFloatArrayCopy,
2628 TfLiteFloatArrayFree,
2629 TfLiteTypeGetName,
2630 TfLiteTensorDataFree,
2631 TfLiteQuantizationFree,
2632 TfLiteSparsityFree,
2633 TfLiteTensorFree,
2634 TfLiteTensorReset,
2635 TfLiteTensorCopy,
2636 TfLiteTensorResizeMaybeCopy,
2637 TfLiteTensorRealloc,
2638 TfLiteDelegateCreate,
2639 TfLiteOpaqueDelegateCreate,
2640 TfLiteOpaqueDelegateDelete,
2641 TfLiteOpaqueDelegateGetData,
2642 TfLiteTensorGetAllocationStrategy,
2643 TfLiteTensorGetBufferAddressStability,
2644 TfLiteTensorGetDataStability,
2645 TfLiteTensorGetDataKnownStep,
2646 TfLiteTensorGetShapeKnownStep,
2647 TfLiteOpaqueTensorType,
2648 TfLiteOpaqueTensorNumDims,
2649 TfLiteOpaqueTensorDim,
2650 TfLiteOpaqueTensorGetNumDimsSignature,
2651 TfLiteOpaqueTensorGetDimSignature,
2652 TfLiteOpaqueTensorIsVariable,
2653 TfLiteOpaqueTensorByteSize,
2654 TfLiteOpaqueTensorData,
2655 TfLiteOpaqueTensorGetAllocationType,
2656 TfLiteOpaqueTensorGetAllocationStrategy,
2657 TfLiteOpaqueTensorGetBufferAddressStability,
2658 TfLiteOpaqueTensorGetDataStability,
2659 TfLiteOpaqueTensorGetDataKnownStep,
2660 TfLiteOpaqueTensorGetShapeKnownStep,
2661 TfLiteOpaqueTensorName,
2662 TfLiteOpaqueTensorGetQuantization,
2663 TfLiteOpaqueTensorGetQuantizationParams,
2664 TfLiteOpaqueTensorCopyFromBuffer,
2665 TfLiteOpaqueTensorCopyToBuffer,
2666 TfLiteOpaqueTensorGetStringCount,
2667 TfLiteOpaqueTensorGetString,
2668 TfLiteOpaqueTensorWriteStrings,
2669 TfLiteOpaqueTensorWriteString,
2670 TfLiteOpaqueTensorBuilderCreate,
2671 TfLiteOpaqueTensorBuilderDelete,
2672 TfLiteOpaqueTensorBuilderSetType,
2673 TfLiteOpaqueTensorBuilderSetData,
2674 TfLiteOpaqueTensorBuilderSetAllocationType,
2675 TfLiteOpaqueTensorBuilderSetQuantizationParams,
2676 TfLiteOpaqueTensorBuilderSetQuantization,
2677 TfLiteOpaqueTensorSetAllocationTypeToDynamic,
2678 TfLiteOpaqueNodeGetInput,
2679 TfLiteOpaqueNodeGetOutput,
2680 TfLiteOpaqueNodeNumberOfInputs,
2681 TfLiteOpaqueNodeNumberOfOutputs,
2682 TfLiteOpaqueNodeGetUserData,
2683 TfLiteOpaqueNodeGetBuiltinData,
2684 TfLiteOpaqueNodeGetCustomInitialData,
2685 TfLiteOpaqueNodeInputs,
2686 TfLiteOpaqueNodeOutputs,
2687 TfLiteOpaqueNodeSetTemporaries,
2688 TfLiteOpaqueNodeTemporaries,
2689 TfLiteOpaqueNodeGetInputTensorIndex,
2690 TfLiteOpaqueNodeGetOutputTensorIndex,
2691 TfLiteOpaqueContextGetExecutionPlan,
2692 TfLiteOpaqueContextGetExternalContext,
2693 TfLiteOpaqueContextGetNodeAndRegistration,
2694 TfLiteOpaqueContextReplaceNodeSubsetsWithDelegateKernels,
2695 TfLiteOpaqueContextGetOpaqueTensor,
2696 TfLiteOpaqueContextGetInputs,
2697 TfLiteOpaqueContextGetOutputs,
2698 TfLiteOpaqueContextGetVariables,
2699 TfLiteOpaqueContextGetNumNodes,
2700 TfLiteOpaqueContextGetNumTensors,
2701 TfLiteOpaqueContextGetName,
2702 TfLiteOpaqueContextResizeTensor,
2703 TfLiteOpaqueContextAcquireSubgraphContext,
2704 TfLiteOpaqueContextReleaseSubgraphContext,
2705 TfLiteOpaqueContextMarkSubgraphAsDelegationSkippable,
2706 TfLiteOpaqueContextGetNodeInitDataMmapInfo,
2707 TfLiteOpaqueContextAddTensor,
2708 TfLiteOpaqueContextGetSizeOfType,
2709 TfLiteOpaqueContextGetMetadata,
2710 TfLiteOpaqueContextReportError,
2711 TfLiteOpaqueContextReportErrorVa,
2712 })
2713 }
2714
2715 #[doc = " Returns a new TfLiteOperator instance.\n\n The returned TfLiteOperator instance represents a definition\n of an operator with the identity (builtin_code/custom_name and\n version) specified by the parameters, but with all callbacks initially\n unset.\n\n Evaluation of any operation using this operator will be done using\n the \"prepare\" and \"invoke\" callbacks, which can be set using\n `TfLiteOperatorSetPrepare` and\n `TfLiteOperatorSetInvoke`, or for async execution\n the \"prepare\", \"eval\", and \"wait\" callbacks of the `TfLiteAsyncKernel`,\n which can be set using `TfLiteOperatorSetAsyncKernel`.\n If the relevant callbacks are not set, then such evaluation will result\n in an error status. So normally any use of this function should be followed\n by appropriate calls to set those callbacks.\n\n \\note The caller retains ownership and should ensure that\n the lifetime of the `TfLiteOperator` must be at least as long as\n the lifetime of any `TfLiteInterpreter` or `tflite::Interpreter` that it is\n used in.\n\n \\param builtin_code Enumeration code specifying which builtin operator this\n defines, or `TfLiteBuiltinCustom` to define a custom op.\n \\param custom_name Name of the custom op, or `nullptr` for a builtin op.\n If `custom_name` is non-null, then `builtin_code` should\n be `TfLiteBuiltinCustom`.\n \\param version Version of the op. See\n https://www.tensorflow.org/lite/guide/ops_version\n \\param user_data Opaque pointer passed to the operator's callbacks set\n with functions such as `TfLiteOperatorSetXXXWithData`.\n The user is expected to manage the memory pointed by\n this field and the lifetime of that memory should extend\n at least from the call to `TfLiteOperatorCreate`\n to the invocation of the callback set with\n `TfLiteOperatorSetFreeWithData`.\n\n \\return a newly created TfLiteOperator on success, or a nullptr on failure"]
2716 pub unsafe fn TfLiteOperatorCreate(
2717 &self,
2718 builtin_code: TfLiteBuiltinOperator,
2719 custom_name: *const ::std::os::raw::c_char,
2720 version: ::std::os::raw::c_int,
2721 user_data: *mut ::std::os::raw::c_void,
2722 ) -> *mut TfLiteOperator {
2723 unsafe {
2724 (self
2725 .TfLiteOperatorCreate
2726 .as_ref()
2727 .expect("Expected function, got error."))(
2728 builtin_code,
2729 custom_name,
2730 version,
2731 user_data,
2732 )
2733 }
2734 }
2735
2736 #[doc = " Destroys the TfLiteOperator instance.\n"]
2737 pub unsafe fn TfLiteOperatorDelete(&self, registration: *mut TfLiteOperator) {
2738 unsafe {
2739 (self
2740 .TfLiteOperatorDelete
2741 .as_ref()
2742 .expect("Expected function, got error."))(registration)
2743 }
2744 }
2745
2746 #[doc = " Return the builtin op code of the provided external 'registration'.\n"]
2747 pub unsafe fn TfLiteOperatorGetBuiltInCode(
2748 &self,
2749 registration: *const TfLiteOperator,
2750 ) -> TfLiteBuiltinOperator {
2751 unsafe {
2752 (self
2753 .TfLiteOperatorGetBuiltInCode
2754 .as_ref()
2755 .expect("Expected function, got error."))(registration)
2756 }
2757 }
2758
2759 #[doc = " Returns the custom name of the provided 'registration'. The returned pointer\n will be non-null iff the op is a custom op.\n"]
2760 pub unsafe fn TfLiteOperatorGetCustomName(
2761 &self,
2762 registration: *const TfLiteOperator,
2763 ) -> *const ::std::os::raw::c_char {
2764 unsafe {
2765 (self
2766 .TfLiteOperatorGetCustomName
2767 .as_ref()
2768 .expect("Expected function, got error."))(registration)
2769 }
2770 }
2771
2772 #[doc = " Return the OP version of the provided external 'registration'. Return -1\n in case of error, or if the provided address is null.\n"]
2773 pub unsafe fn TfLiteOperatorGetVersion(
2774 &self,
2775 registration: *const TfLiteOperator,
2776 ) -> ::std::os::raw::c_int {
2777 unsafe {
2778 (self
2779 .TfLiteOperatorGetVersion
2780 .as_ref()
2781 .expect("Expected function, got error."))(registration)
2782 }
2783 }
2784
2785 #[doc = " Return the user data field of the provided external 'registration', or\n nullptr if none was set.\n"]
2786 pub unsafe fn TfLiteOperatorGetUserData(
2787 &self,
2788 registration: *const TfLiteOperator,
2789 ) -> *mut ::std::os::raw::c_void {
2790 unsafe {
2791 (self
2792 .TfLiteOperatorGetUserData
2793 .as_ref()
2794 .expect("Expected function, got error."))(registration)
2795 }
2796 }
2797
2798 #[doc = " Sets the initialization callback for the registration.\n\n The callback is called to initialize the op from serialized data.\n Please refer `init` of `TfLiteRegistration` for the detail.\n\n Deprecated: Use `TfLiteOperatorSetInitWithData`"]
2799 pub unsafe fn TfLiteOperatorSetInit(
2800 &self,
2801 registration: *mut TfLiteOperator,
2802 init: ::std::option::Option<
2803 unsafe extern "C" fn(
2804 context: *mut TfLiteOpaqueContext,
2805 buffer: *const ::std::os::raw::c_char,
2806 length: usize,
2807 ) -> *mut ::std::os::raw::c_void,
2808 >,
2809 ) {
2810 unsafe {
2811 (self
2812 .TfLiteOperatorSetInit
2813 .as_ref()
2814 .expect("Expected function, got error."))(registration, init)
2815 }
2816 }
2817
2818 #[doc = " Sets the initialization callback for the registration. The function returns\n an error upon failure.\n\n The callback is called to initialize the op from serialized data. The value\n passed in the `user_data` parameter is the value that was passed to\n `TfLiteOperatorCreate`. Please refer `init` of `TfLiteRegistration`\n for the detail.\n"]
2819 pub unsafe fn TfLiteOperatorSetInitWithData(
2820 &self,
2821 registration: *mut TfLiteOperator,
2822 init: ::std::option::Option<
2823 unsafe extern "C" fn(
2824 user_data: *mut ::std::os::raw::c_void,
2825 context: *mut TfLiteOpaqueContext,
2826 buffer: *const ::std::os::raw::c_char,
2827 length: usize,
2828 ) -> *mut ::std::os::raw::c_void,
2829 >,
2830 ) -> TfLiteStatus {
2831 unsafe {
2832 (self
2833 .TfLiteOperatorSetInitWithData
2834 .as_ref()
2835 .expect("Expected function, got error."))(registration, init)
2836 }
2837 }
2838
2839 #[doc = " Sets the deallocation callback for the registration.\n\n This callback is called to deallocate the data returned by the init\n callback. The value passed in the `data` parameter is the value that was\n returned by the `init` callback. Please refer `free` of `TfLiteRegistration`\n for the detail.\n\n Deprecated: Use `TfLiteOperatorSetFreeWithData`"]
2840 pub unsafe fn TfLiteOperatorSetFree(
2841 &self,
2842 registration: *mut TfLiteOperator,
2843 free: ::std::option::Option<
2844 unsafe extern "C" fn(
2845 context: *mut TfLiteOpaqueContext,
2846 data: *mut ::std::os::raw::c_void,
2847 ),
2848 >,
2849 ) {
2850 unsafe {
2851 (self
2852 .TfLiteOperatorSetFree
2853 .as_ref()
2854 .expect("Expected function, got error."))(registration, free)
2855 }
2856 }
2857
2858 #[doc = " Sets the deallocation callback for the registration, similarly to\n `TfLiteOperatorSetFree`. The function returns an error upon failure.\n\n This callback is called to deallocate the data returned by the init\n callback. The value passed in the `data` parameter is the value that was\n returned by the `init` callback. The value passed in the `user_data`\n parameter is the value that was passed to `TfLiteOperatorCreate`.\n Please refer `free` of `TfLiteRegistration` for the detail.\n"]
2859 pub unsafe fn TfLiteOperatorSetFreeWithData(
2860 &self,
2861 registration: *mut TfLiteOperator,
2862 free: ::std::option::Option<
2863 unsafe extern "C" fn(
2864 user_data: *mut ::std::os::raw::c_void,
2865 context: *mut TfLiteOpaqueContext,
2866 data: *mut ::std::os::raw::c_void,
2867 ),
2868 >,
2869 ) -> TfLiteStatus {
2870 unsafe {
2871 (self
2872 .TfLiteOperatorSetFreeWithData
2873 .as_ref()
2874 .expect("Expected function, got error."))(registration, free)
2875 }
2876 }
2877
2878 #[doc = " Sets the preparation callback for the registration.\n\n The callback is called when the inputs of operator have been resized.\n Please refer `prepare` of `TfLiteRegistration` for the detail.\n\n Deprecated: Use `TfLiteOperatorSetPrepareWithData`"]
2879 pub unsafe fn TfLiteOperatorSetPrepare(
2880 &self,
2881 registration: *mut TfLiteOperator,
2882 prepare: ::std::option::Option<
2883 unsafe extern "C" fn(
2884 context: *mut TfLiteOpaqueContext,
2885 node: *mut TfLiteOpaqueNode,
2886 ) -> TfLiteStatus,
2887 >,
2888 ) {
2889 unsafe {
2890 (self
2891 .TfLiteOperatorSetPrepare
2892 .as_ref()
2893 .expect("Expected function, got error."))(registration, prepare)
2894 }
2895 }
2896
2897 #[doc = " Sets the preparation callback for the registration. The function returns an\n error upon failure.\n\n The callback is called when the inputs of operator have been resized. The\n value passed in the `user_data` parameter is the value that was passed to\n `TfLiteOperatorCreate`. Please refer `prepare` of\n `TfLiteRegistration` for the detail.\n"]
2898 pub unsafe fn TfLiteOperatorSetPrepareWithData(
2899 &self,
2900 registration: *mut TfLiteOperator,
2901 prepare: ::std::option::Option<
2902 unsafe extern "C" fn(
2903 user_data: *mut ::std::os::raw::c_void,
2904 context: *mut TfLiteOpaqueContext,
2905 node: *mut TfLiteOpaqueNode,
2906 ) -> TfLiteStatus,
2907 >,
2908 ) -> TfLiteStatus {
2909 unsafe {
2910 (self
2911 .TfLiteOperatorSetPrepareWithData
2912 .as_ref()
2913 .expect("Expected function, got error."))(registration, prepare)
2914 }
2915 }
2916
2917 #[doc = " Sets the invocation callback for the registration.\n\n The callback is called when the operator is executed.\n Please refer `invoke` of `TfLiteRegistration` for the detail.\n\n Deprecated: Use `TfLiteOperatorSetInvokeWithData`"]
2918 pub unsafe fn TfLiteOperatorSetInvoke(
2919 &self,
2920 registration: *mut TfLiteOperator,
2921 invoke: ::std::option::Option<
2922 unsafe extern "C" fn(
2923 context: *mut TfLiteOpaqueContext,
2924 node: *mut TfLiteOpaqueNode,
2925 ) -> TfLiteStatus,
2926 >,
2927 ) {
2928 unsafe {
2929 (self
2930 .TfLiteOperatorSetInvoke
2931 .as_ref()
2932 .expect("Expected function, got error."))(registration, invoke)
2933 }
2934 }
2935
2936 #[doc = " Sets the invocation callback for the registration. The function returns an\n error upon failure.\n\n The callback is called when the operator is executed. The value passed in\n the `user_data` parameter is the value that was passed to\n `TfLiteOperatorCreate`. Please refer `invoke` of `TfLiteRegistration` for\n the detail.\n"]
2937 pub unsafe fn TfLiteOperatorSetInvokeWithData(
2938 &self,
2939 registration: *mut TfLiteOperator,
2940 invoke: ::std::option::Option<
2941 unsafe extern "C" fn(
2942 user_data: *mut ::std::os::raw::c_void,
2943 context: *mut TfLiteOpaqueContext,
2944 node: *mut TfLiteOpaqueNode,
2945 ) -> TfLiteStatus,
2946 >,
2947 ) -> TfLiteStatus {
2948 unsafe {
2949 (self
2950 .TfLiteOperatorSetInvokeWithData
2951 .as_ref()
2952 .expect("Expected function, got error."))(registration, invoke)
2953 }
2954 }
2955
2956 #[doc = " Sets the async kernel accessor callback for the registration.\n\n The callback is called to retrieve the async kernel if the delegate supports\n it. If the delegate does not support async execution, either this function\n should not be called, or `async_kernel` needs to be nullptr.\n `node` is the delegate TfLiteNode created by `ModifyGraphWithDelegate`.\n Please refer `async_kernel` of `TfLiteRegistration` for the detail.\n\n \\warning This is an experimental API and subject to change.\n Deprecated: Use `TfLiteOperatorSetAsyncKernelWithData`"]
2957 pub unsafe fn TfLiteOperatorSetAsyncKernel(
2958 &self,
2959 registration: *mut TfLiteOperator,
2960 async_kernel: ::std::option::Option<
2961 unsafe extern "C" fn(
2962 context: *mut TfLiteOpaqueContext,
2963 node: *mut TfLiteOpaqueNode,
2964 ) -> *mut TfLiteAsyncKernel,
2965 >,
2966 ) {
2967 unsafe {
2968 (self
2969 .TfLiteOperatorSetAsyncKernel
2970 .as_ref()
2971 .expect("Expected function, got error."))(registration, async_kernel)
2972 }
2973 }
2974
2975 #[doc = " Sets the async kernel accessor callback for the registration. The function\n returns an error upon failure.\n\n The callback is called to retrieve the async kernel if the delegate supports\n it. If the delegate does not support async execution, either this function\n should not be called, or `async_kernel` needs to be nullptr. `node` is the\n delegate TfLiteNode created by `ModifyGraphWithDelegate`. The value passed\n in the `user_data` parameter is the value that was passed to\n `TfLiteOperatorCreate`. Please refer `async_kernel` of `TfLiteRegistration`\n for the detail.\n\n \\warning This is an experimental API and subject to change."]
2976 pub unsafe fn TfLiteOperatorSetAsyncKernelWithData(
2977 &self,
2978 registration: *mut TfLiteOperator,
2979 async_kernel: ::std::option::Option<
2980 unsafe extern "C" fn(
2981 user_data: *mut ::std::os::raw::c_void,
2982 context: *mut TfLiteOpaqueContext,
2983 node: *mut TfLiteOpaqueNode,
2984 ) -> *mut TfLiteAsyncKernel,
2985 >,
2986 ) -> TfLiteStatus {
2987 unsafe {
2988 (self
2989 .TfLiteOperatorSetAsyncKernelWithData
2990 .as_ref()
2991 .expect("Expected function, got error."))(registration, async_kernel)
2992 }
2993 }
2994
2995 #[doc = " Sets the inplace_operator field of the external registration.\n\n This is a bitmask. Please refer to `inplace_operator` field of\n `TfLiteRegistration` for details.\n"]
2996 pub unsafe fn TfLiteOperatorSetInplaceOperator(
2997 &self,
2998 registration: *mut TfLiteOperator,
2999 inplace_operator: u64,
3000 ) {
3001 unsafe {
3002 (self
3003 .TfLiteOperatorSetInplaceOperator
3004 .as_ref()
3005 .expect("Expected function, got error."))(registration, inplace_operator)
3006 }
3007 }
3008
3009 #[doc = " The TensorFlow Lite Runtime version.\n\n Returns a pointer to a statically allocated string that is the version\n number of the (potentially dynamically loaded) TF Lite Runtime library.\n TensorFlow Lite uses semantic versioning, and the return value should be\n in semver 2 format <http://semver.org>, starting with MAJOR.MINOR.PATCH,\n e.g. \"2.12.0\" or \"2.13.0-rc2\"."]
3010 pub unsafe fn TfLiteVersion(&self) -> *const ::std::os::raw::c_char {
3011 unsafe {
3012 (self
3013 .TfLiteVersion
3014 .as_ref()
3015 .expect("Expected function, got error."))()
3016 }
3017 }
3018
3019 #[doc = " The TensorFlow Lite Extension APIs version.\n\n Returns a pointer to a statically allocated string that is the version\n number of the TF Lite Extension APIs supported by the (potentially\n dynamically loaded) TF Lite Runtime library. The TF Lite \"Extension APIs\"\n are the APIs for extending TF Lite with custom ops and delegates.\n More specifically, this version number covers the (non-experimental)\n functionality documented in the following header files:\n\n * lite/c/c_api_opaque.h\n * lite/c/common.h\n * lite/c/builtin_op_data.h\n * lite/builtin_ops.h\n\n This version number uses semantic versioning, and the return value should\n be in semver 2 format <http://semver.org>, starting with MAJOR.MINOR.PATCH,\n e.g. \"2.14.0\" or \"2.15.0-rc2\"."]
3020 pub unsafe fn TfLiteExtensionApisVersion(&self) -> *const ::std::os::raw::c_char {
3021 unsafe {
3022 (self
3023 .TfLiteExtensionApisVersion
3024 .as_ref()
3025 .expect("Expected function, got error."))()
3026 }
3027 }
3028
3029 #[doc = " The supported TensorFlow Lite model file Schema version.\n\n Returns the (major) version number of the Schema used for model\n files that is supported by the (potentially dynamically loaded)\n TensorFlow Lite Runtime.\n\n Model files using schema versions different to this may not be supported by\n the current version of the TF Lite Runtime."]
3030 pub unsafe fn TfLiteSchemaVersion(&self) -> ::std::os::raw::c_int {
3031 unsafe {
3032 (self
3033 .TfLiteSchemaVersion
3034 .as_ref()
3035 .expect("Expected function, got error."))()
3036 }
3037 }
3038
3039 #[doc = " Returns a model from the provided buffer, or null on failure.\n\n \\note The caller retains ownership of the `model_data` buffer and should\n ensure that the lifetime of the `model_data` buffer must be at least as long\n as the lifetime of the `TfLiteModel` and of any `TfLiteInterpreter` objects\n created from that `TfLiteModel`, and furthermore the contents of the\n `model_data` buffer must not be modified during that time.\""]
3040 pub unsafe fn TfLiteModelCreate(
3041 &self,
3042 model_data: *const ::std::os::raw::c_void,
3043 model_size: usize,
3044 ) -> *mut TfLiteModel {
3045 unsafe {
3046 (self
3047 .TfLiteModelCreate
3048 .as_ref()
3049 .expect("Expected function, got error."))(model_data, model_size)
3050 }
3051 }
3052
3053 #[doc = " Same as `TfLiteModelCreate` with customizble error reporter.\n * `reporter` takes the provided `user_data` object, as well as a C-style\n format string and arg list (see also vprintf).\n * `user_data` is optional. If non-null, it is owned by the client and must\n remain valid for the duration of the interpreter lifetime."]
3054 pub unsafe fn TfLiteModelCreateWithErrorReporter(
3055 &self,
3056 model_data: *const ::std::os::raw::c_void,
3057 model_size: usize,
3058 reporter: ::std::option::Option<
3059 unsafe extern "C" fn(
3060 user_data: *mut ::std::os::raw::c_void,
3061 format: *const ::std::os::raw::c_char,
3062 args: *mut __va_list_tag,
3063 ),
3064 >,
3065 user_data: *mut ::std::os::raw::c_void,
3066 ) -> *mut TfLiteModel {
3067 unsafe {
3068 (self
3069 .TfLiteModelCreateWithErrorReporter
3070 .as_ref()
3071 .expect("Expected function, got error."))(
3072 model_data, model_size, reporter, user_data,
3073 )
3074 }
3075 }
3076
3077 #[doc = " Returns a model from the provided file, or null on failure.\n\n \\note The file's contents must not be modified during the lifetime of the\n `TfLiteModel` or of any `TfLiteInterpreter` objects created from that\n `TfLiteModel`."]
3078 pub unsafe fn TfLiteModelCreateFromFile(
3079 &self,
3080 model_path: *const ::std::os::raw::c_char,
3081 ) -> *mut TfLiteModel {
3082 unsafe {
3083 (self
3084 .TfLiteModelCreateFromFile
3085 .as_ref()
3086 .expect("Expected function, got error."))(model_path)
3087 }
3088 }
3089
3090 #[doc = " Same as `TfLiteModelCreateFromFile` with customizble error reporter.\n * `reporter` takes the provided `user_data` object, as well as a C-style\n format string and arg list (see also vprintf).\n * `user_data` is optional. If non-null, it is owned by the client and must\n remain valid for the duration of the interpreter lifetime."]
3091 pub unsafe fn TfLiteModelCreateFromFileWithErrorReporter(
3092 &self,
3093 model_path: *const ::std::os::raw::c_char,
3094 reporter: ::std::option::Option<
3095 unsafe extern "C" fn(
3096 user_data: *mut ::std::os::raw::c_void,
3097 format: *const ::std::os::raw::c_char,
3098 args: *mut __va_list_tag,
3099 ),
3100 >,
3101 user_data: *mut ::std::os::raw::c_void,
3102 ) -> *mut TfLiteModel {
3103 unsafe {
3104 (self
3105 .TfLiteModelCreateFromFileWithErrorReporter
3106 .as_ref()
3107 .expect("Expected function, got error."))(
3108 model_path, reporter, user_data
3109 )
3110 }
3111 }
3112
3113 #[doc = " Destroys the model instance."]
3114 pub unsafe fn TfLiteModelDelete(&self, model: *mut TfLiteModel) {
3115 unsafe {
3116 (self
3117 .TfLiteModelDelete
3118 .as_ref()
3119 .expect("Expected function, got error."))(model)
3120 }
3121 }
3122
3123 #[doc = " Returns a new interpreter options instances."]
3124 pub unsafe fn TfLiteInterpreterOptionsCreate(&self) -> *mut TfLiteInterpreterOptions {
3125 unsafe {
3126 (self
3127 .TfLiteInterpreterOptionsCreate
3128 .as_ref()
3129 .expect("Expected function, got error."))()
3130 }
3131 }
3132
3133 #[doc = " Creates and returns a shallow copy of an options object.\n\n The caller is responsible for calling `TfLiteInterpreterOptionsDelete` to\n deallocate the object pointed to by the returned pointer."]
3134 pub unsafe fn TfLiteInterpreterOptionsCopy(
3135 &self,
3136 from: *const TfLiteInterpreterOptions,
3137 ) -> *mut TfLiteInterpreterOptions {
3138 unsafe {
3139 (self
3140 .TfLiteInterpreterOptionsCopy
3141 .as_ref()
3142 .expect("Expected function, got error."))(from)
3143 }
3144 }
3145
3146 #[doc = " Destroys the interpreter options instance."]
3147 pub unsafe fn TfLiteInterpreterOptionsDelete(&self, options: *mut TfLiteInterpreterOptions) {
3148 unsafe {
3149 (self
3150 .TfLiteInterpreterOptionsDelete
3151 .as_ref()
3152 .expect("Expected function, got error."))(options)
3153 }
3154 }
3155
3156 #[doc = " Sets the number of CPU threads to use for the interpreter."]
3157 pub unsafe fn TfLiteInterpreterOptionsSetNumThreads(
3158 &self,
3159 options: *mut TfLiteInterpreterOptions,
3160 num_threads: i32,
3161 ) {
3162 unsafe {
3163 (self
3164 .TfLiteInterpreterOptionsSetNumThreads
3165 .as_ref()
3166 .expect("Expected function, got error."))(options, num_threads)
3167 }
3168 }
3169
3170 #[doc = " Adds a delegate to be applied during `TfLiteInterpreter` creation.\n\n If delegate application fails, interpreter creation will also fail with an\n associated error logged.\n\n \\note The caller retains ownership of the delegate and should ensure that it\n remains valid for the duration of any created interpreter's lifetime.\n\n If you are NOT using \"TensorFlow Lite in Play Services\", and NOT building\n with `TFLITE_WITH_STABLE_ABI` or `TFLITE_USE_OPAQUE_DELEGATE` macros\n enabled, it is possible to pass a `TfLiteDelegate*` rather than a\n `TfLiteOpaqueDelegate*` to this function, since in those cases,\n `TfLiteOpaqueDelegate` is just a typedef alias for `TfLiteDelegate`.\n This is for compatibility with existing source code\n and existing delegates. For new delegates, it is recommended to\n use `TfLiteOpaqueDelegate` rather than `TfLiteDelegate`. (See\n `TfLiteOpaqueDelegate` in tensorflow/lite/core/c/c_api_types.h.)"]
3171 pub unsafe fn TfLiteInterpreterOptionsAddDelegate(
3172 &self,
3173 options: *mut TfLiteInterpreterOptions,
3174 delegate: *mut TfLiteOpaqueDelegate,
3175 ) {
3176 unsafe {
3177 (self
3178 .TfLiteInterpreterOptionsAddDelegate
3179 .as_ref()
3180 .expect("Expected function, got error."))(options, delegate)
3181 }
3182 }
3183
3184 #[doc = " Sets a custom error reporter for interpreter execution.\n\n * `reporter` takes the provided `user_data` object, as well as a C-style\n format string and arg list (see also vprintf).\n * `user_data` is optional. If non-null, it is owned by the client and must\n remain valid for the duration of the interpreter lifetime."]
3185 pub unsafe fn TfLiteInterpreterOptionsSetErrorReporter(
3186 &self,
3187 options: *mut TfLiteInterpreterOptions,
3188 reporter: ::std::option::Option<
3189 unsafe extern "C" fn(
3190 user_data: *mut ::std::os::raw::c_void,
3191 format: *const ::std::os::raw::c_char,
3192 args: *mut __va_list_tag,
3193 ),
3194 >,
3195 user_data: *mut ::std::os::raw::c_void,
3196 ) {
3197 unsafe {
3198 (self
3199 .TfLiteInterpreterOptionsSetErrorReporter
3200 .as_ref()
3201 .expect("Expected function, got error."))(options, reporter, user_data)
3202 }
3203 }
3204
3205 #[doc = " Adds an op registration to be applied during `TfLiteInterpreter` creation.\n\n The `TfLiteOperator` object is needed to implement custom op of\n TFLite Interpreter via C API. Calling this function ensures that any\n `TfLiteInterpreter` created with the specified `options` can execute models\n that use the custom operator specified in `registration`.\n Please refer https://www.tensorflow.org/lite/guide/ops_custom for custom op\n support.\n \\note The caller retains ownership of the TfLiteOperator object\n and should ensure that it remains valid for the duration of any created\n interpreter's lifetime.\n \\warning This is an experimental API and subject to change."]
3206 pub unsafe fn TfLiteInterpreterOptionsAddOperator(
3207 &self,
3208 options: *mut TfLiteInterpreterOptions,
3209 registration: *mut TfLiteOperator,
3210 ) {
3211 unsafe {
3212 (self
3213 .TfLiteInterpreterOptionsAddOperator
3214 .as_ref()
3215 .expect("Expected function, got error."))(options, registration)
3216 }
3217 }
3218
3219 #[doc = " Enables users to cancel in-flight invocations with\n `TfLiteInterpreterCancel`.\n\n By default it is disabled and calling to `TfLiteInterpreterCancel` will\n return kTfLiteError. See `TfLiteInterpreterCancel`."]
3220 pub unsafe fn TfLiteInterpreterOptionsEnableCancellation(
3221 &self,
3222 options: *mut TfLiteInterpreterOptions,
3223 enable: bool,
3224 ) -> TfLiteStatus {
3225 unsafe {
3226 (self
3227 .TfLiteInterpreterOptionsEnableCancellation
3228 .as_ref()
3229 .expect("Expected function, got error."))(options, enable)
3230 }
3231 }
3232
3233 #[doc = " Returns a new interpreter using the provided model and options, or null on\n failure.\n\n * `model` must be a valid model instance. The caller retains ownership of\n the object, and may destroy it (via TfLiteModelDelete) immediately after\n creating the interpreter. However, if the TfLiteModel was allocated with\n TfLiteModelCreate, then the `model_data` buffer that was passed to\n TfLiteModelCreate must outlive the lifetime of the TfLiteInterpreter\n object that this function returns, and must not be modified during that\n time; and if the TfLiteModel was allocated with TfLiteModelCreateFromFile,\n then the contents of the model file must not be modified during the\n lifetime of the TfLiteInterpreter object that this function returns.\n * `optional_options` may be null. The caller retains ownership of the\n object, and can safely destroy it (via TfLiteInterpreterOptionsDelete)\n immediately after creating the interpreter.\n\n \\note The client *must* explicitly allocate tensors before attempting to\n access input tensor data or invoke the interpreter."]
3234 pub unsafe fn TfLiteInterpreterCreate(
3235 &self,
3236 model: *const TfLiteModel,
3237 optional_options: *const TfLiteInterpreterOptions,
3238 ) -> *mut TfLiteInterpreter {
3239 unsafe {
3240 (self
3241 .TfLiteInterpreterCreate
3242 .as_ref()
3243 .expect("Expected function, got error."))(model, optional_options)
3244 }
3245 }
3246
3247 #[doc = " Destroys the interpreter."]
3248 pub unsafe fn TfLiteInterpreterDelete(&self, interpreter: *mut TfLiteInterpreter) {
3249 unsafe {
3250 (self
3251 .TfLiteInterpreterDelete
3252 .as_ref()
3253 .expect("Expected function, got error."))(interpreter)
3254 }
3255 }
3256
3257 #[doc = " Returns the number of input tensors associated with the model."]
3258 pub unsafe fn TfLiteInterpreterGetInputTensorCount(
3259 &self,
3260 interpreter: *const TfLiteInterpreter,
3261 ) -> i32 {
3262 unsafe {
3263 (self
3264 .TfLiteInterpreterGetInputTensorCount
3265 .as_ref()
3266 .expect("Expected function, got error."))(interpreter)
3267 }
3268 }
3269
3270 #[doc = " Returns a pointer to an array of input tensor indices. The length of the\n array can be obtained via a call to `TfLiteInterpreterGetInputTensorCount`.\n\n Typically the input tensors associated with an `interpreter` would be set\n during the initialization of the `interpreter`, through a mechanism like the\n `InterpreterBuilder`, and remain unchanged throughout the lifetime of the\n interpreter. However, there are some circumstances in which the pointer may\n not remain valid throughout the lifetime of the interpreter, because calls\n to `SetInputs` on the interpreter invalidate the returned pointer.\n\n The ownership of the array remains with the TFLite runtime."]
3271 pub unsafe fn TfLiteInterpreterInputTensorIndices(
3272 &self,
3273 interpreter: *const TfLiteInterpreter,
3274 ) -> *const ::std::os::raw::c_int {
3275 unsafe {
3276 (self
3277 .TfLiteInterpreterInputTensorIndices
3278 .as_ref()
3279 .expect("Expected function, got error."))(interpreter)
3280 }
3281 }
3282
3283 #[doc = " Returns the tensor associated with the input index.\n REQUIRES: 0 <= input_index < TfLiteInterpreterGetInputTensorCount(tensor)"]
3284 pub unsafe fn TfLiteInterpreterGetInputTensor(
3285 &self,
3286 interpreter: *const TfLiteInterpreter,
3287 input_index: i32,
3288 ) -> *mut TfLiteTensor {
3289 unsafe {
3290 (self
3291 .TfLiteInterpreterGetInputTensor
3292 .as_ref()
3293 .expect("Expected function, got error."))(interpreter, input_index)
3294 }
3295 }
3296
3297 #[doc = " Resizes the specified input tensor.\n\n \\note After a resize, the client *must* explicitly allocate tensors before\n attempting to access the resized tensor data or invoke the interpreter.\n\n REQUIRES: 0 <= input_index < TfLiteInterpreterGetInputTensorCount(tensor)\n\n This function makes a copy of the input dimensions, so the client can safely\n deallocate `input_dims` immediately after this function returns."]
3298 pub unsafe fn TfLiteInterpreterResizeInputTensor(
3299 &self,
3300 interpreter: *mut TfLiteInterpreter,
3301 input_index: i32,
3302 input_dims: *const ::std::os::raw::c_int,
3303 input_dims_size: i32,
3304 ) -> TfLiteStatus {
3305 unsafe {
3306 (self
3307 .TfLiteInterpreterResizeInputTensor
3308 .as_ref()
3309 .expect("Expected function, got error."))(
3310 interpreter,
3311 input_index,
3312 input_dims,
3313 input_dims_size,
3314 )
3315 }
3316 }
3317
3318 #[doc = " Updates allocations for all tensors, resizing dependent tensors using the\n specified input tensor dimensionality.\n\n This is a relatively expensive operation, and need only be called after\n creating the graph and/or resizing any inputs."]
3319 pub unsafe fn TfLiteInterpreterAllocateTensors(
3320 &self,
3321 interpreter: *mut TfLiteInterpreter,
3322 ) -> TfLiteStatus {
3323 unsafe {
3324 (self
3325 .TfLiteInterpreterAllocateTensors
3326 .as_ref()
3327 .expect("Expected function, got error."))(interpreter)
3328 }
3329 }
3330
3331 #[doc = " Runs inference for the loaded graph.\n\n Before calling this function, the caller should first invoke\n TfLiteInterpreterAllocateTensors() and should also set the values for the\n input tensors. After successfully calling this function, the values for the\n output tensors will be set.\n\n \\note It is possible that the interpreter is not in a ready state to\n evaluate (e.g., if AllocateTensors() hasn't been called, or if a\n ResizeInputTensor() has been performed without a subsequent call to\n AllocateTensors()).\n\n If the (experimental!) delegate fallback option was enabled in the\n interpreter options, then the interpreter will automatically fall back to\n not using any delegates if execution with delegates fails. For details,\n see TfLiteInterpreterOptionsSetEnableDelegateFallback in\n c_api_experimental.h.\n\n Returns one of the following status codes:\n - kTfLiteOk: Success. Output is valid.\n - kTfLiteDelegateError: Execution with delegates failed, due to a problem\n with the delegate(s). If fallback was not enabled, output is invalid.\n If fallback was enabled, this return value indicates that fallback\n succeeded, the output is valid, and all delegates previously applied to\n the interpreter have been undone.\n - kTfLiteApplicationError: Same as for kTfLiteDelegateError, except that\n the problem was not with the delegate itself, but rather was\n due to an incompatibility between the delegate(s) and the\n interpreter or model.\n - kTfLiteError: Unexpected/runtime failure. Output is invalid."]
3332 pub unsafe fn TfLiteInterpreterInvoke(
3333 &self,
3334 interpreter: *mut TfLiteInterpreter,
3335 ) -> TfLiteStatus {
3336 unsafe {
3337 (self
3338 .TfLiteInterpreterInvoke
3339 .as_ref()
3340 .expect("Expected function, got error."))(interpreter)
3341 }
3342 }
3343
3344 #[doc = " Returns the number of output tensors associated with the model."]
3345 pub unsafe fn TfLiteInterpreterGetOutputTensorCount(
3346 &self,
3347 interpreter: *const TfLiteInterpreter,
3348 ) -> i32 {
3349 unsafe {
3350 (self
3351 .TfLiteInterpreterGetOutputTensorCount
3352 .as_ref()
3353 .expect("Expected function, got error."))(interpreter)
3354 }
3355 }
3356
3357 #[doc = " Returns a pointer to an array of output tensor indices. The length of the\n array can be obtained via a call to `TfLiteInterpreterGetOutputTensorCount`.\n\n Typically the output tensors associated with an `interpreter` would be set\n during the initialization of the `interpreter`, through a mechanism like the\n `InterpreterBuilder`, and remain unchanged throughout the lifetime of the\n interpreter. However, there are some circumstances in which the pointer may\n not remain valid throughout the lifetime of the interpreter, because calls\n to `SetOutputs` on the interpreter invalidate the returned pointer.\n\n The ownership of the array remains with the TFLite runtime."]
3358 pub unsafe fn TfLiteInterpreterOutputTensorIndices(
3359 &self,
3360 interpreter: *const TfLiteInterpreter,
3361 ) -> *const ::std::os::raw::c_int {
3362 unsafe {
3363 (self
3364 .TfLiteInterpreterOutputTensorIndices
3365 .as_ref()
3366 .expect("Expected function, got error."))(interpreter)
3367 }
3368 }
3369
3370 #[doc = " Returns the tensor associated with the output index.\n REQUIRES: 0 <= output_index < TfLiteInterpreterGetOutputTensorCount(tensor)\n\n \\note The shape and underlying data buffer for output tensors may be not\n be available until after the output tensor has been both sized and\n allocated.\n In general, best practice is to interact with the output tensor *after*\n calling TfLiteInterpreterInvoke()."]
3371 pub unsafe fn TfLiteInterpreterGetOutputTensor(
3372 &self,
3373 interpreter: *const TfLiteInterpreter,
3374 output_index: i32,
3375 ) -> *const TfLiteTensor {
3376 unsafe {
3377 (self
3378 .TfLiteInterpreterGetOutputTensor
3379 .as_ref()
3380 .expect("Expected function, got error."))(interpreter, output_index)
3381 }
3382 }
3383
3384 #[doc = " Returns modifiable access to the tensor that corresponds to the\n specified `index` and is associated with the provided `interpreter`.\n\n This requires the `index` to be between 0 and N - 1, where N is the\n number of tensors in the model.\n\n Typically the tensors associated with the `interpreter` would be set during\n the `interpreter` initialization, through a mechanism like the\n `InterpreterBuilder`, and remain unchanged throughout the lifetime of the\n interpreter. However, there are some circumstances in which the pointer may\n not remain valid throughout the lifetime of the interpreter, because calls\n to `AddTensors` on the interpreter invalidate the returned pointer.\n\n Note the difference between this function and\n `TfLiteInterpreterGetInputTensor` (or `TfLiteInterpreterGetOutputTensor` for\n that matter): `TfLiteInterpreterGetTensor` takes an index into the array of\n all tensors associated with the `interpreter`'s model, whereas\n `TfLiteInterpreterGetInputTensor` takes an index into the array of input\n tensors.\n\n The ownership of the tensor remains with the TFLite runtime, meaning the\n caller should not deallocate the pointer."]
3385 pub unsafe fn TfLiteInterpreterGetTensor(
3386 &self,
3387 interpreter: *const TfLiteInterpreter,
3388 index: ::std::os::raw::c_int,
3389 ) -> *mut TfLiteTensor {
3390 unsafe {
3391 (self
3392 .TfLiteInterpreterGetTensor
3393 .as_ref()
3394 .expect("Expected function, got error."))(interpreter, index)
3395 }
3396 }
3397
3398 #[doc = " Tries to cancel any in-flight invocation.\n\n \\note This only cancels `TfLiteInterpreterInvoke` calls that happen before\n calling this and it does not cancel subsequent invocations.\n \\note Calling this function will also cancel any in-flight invocations of\n SignatureRunners constructed from this interpreter.\n Non-blocking and thread safe.\n\n Returns kTfLiteError if cancellation is not enabled via\n `TfLiteInterpreterOptionsEnableCancellation`."]
3399 pub unsafe fn TfLiteInterpreterCancel(
3400 &self,
3401 interpreter: *const TfLiteInterpreter,
3402 ) -> TfLiteStatus {
3403 unsafe {
3404 (self
3405 .TfLiteInterpreterCancel
3406 .as_ref()
3407 .expect("Expected function, got error."))(interpreter)
3408 }
3409 }
3410
3411 #[doc = " Returns the number of signatures defined in the model."]
3412 pub unsafe fn TfLiteInterpreterGetSignatureCount(
3413 &self,
3414 interpreter: *const TfLiteInterpreter,
3415 ) -> i32 {
3416 unsafe {
3417 (self
3418 .TfLiteInterpreterGetSignatureCount
3419 .as_ref()
3420 .expect("Expected function, got error."))(interpreter)
3421 }
3422 }
3423
3424 #[doc = " Returns the key of the Nth signature in the model, where N is specified as\n `signature_index`.\n\n NOTE: The lifetime of the returned key is the same as (and depends on) the\n lifetime of `interpreter`."]
3425 pub unsafe fn TfLiteInterpreterGetSignatureKey(
3426 &self,
3427 interpreter: *const TfLiteInterpreter,
3428 signature_index: i32,
3429 ) -> *const ::std::os::raw::c_char {
3430 unsafe {
3431 (self
3432 .TfLiteInterpreterGetSignatureKey
3433 .as_ref()
3434 .expect("Expected function, got error."))(interpreter, signature_index)
3435 }
3436 }
3437
3438 #[doc = " Returns a new signature runner using the provided interpreter and signature\n key, or nullptr on failure.\n\n NOTE: `signature_key` is a null-terminated C string that must match the\n key of a signature in the interpreter's model.\n\n NOTE: The returned signature runner should be destroyed, by calling\n TfLiteSignatureRunnerDelete(), before the interpreter is destroyed."]
3439 pub unsafe fn TfLiteInterpreterGetSignatureRunner(
3440 &self,
3441 interpreter: *const TfLiteInterpreter,
3442 signature_key: *const ::std::os::raw::c_char,
3443 ) -> *mut TfLiteSignatureRunner {
3444 unsafe {
3445 (self
3446 .TfLiteInterpreterGetSignatureRunner
3447 .as_ref()
3448 .expect("Expected function, got error."))(interpreter, signature_key)
3449 }
3450 }
3451
3452 #[doc = " Returns the number of inputs associated with a signature."]
3453 pub unsafe fn TfLiteSignatureRunnerGetInputCount(
3454 &self,
3455 signature_runner: *const TfLiteSignatureRunner,
3456 ) -> usize {
3457 unsafe {
3458 (self
3459 .TfLiteSignatureRunnerGetInputCount
3460 .as_ref()
3461 .expect("Expected function, got error."))(signature_runner)
3462 }
3463 }
3464
3465 #[doc = " Returns the (null-terminated) name of the Nth input in a signature, where N\n is specified as `input_index`.\n\n NOTE: The lifetime of the returned name is the same as (and depends on) the\n lifetime of `signature_runner`."]
3466 pub unsafe fn TfLiteSignatureRunnerGetInputName(
3467 &self,
3468 signature_runner: *const TfLiteSignatureRunner,
3469 input_index: i32,
3470 ) -> *const ::std::os::raw::c_char {
3471 unsafe {
3472 (self
3473 .TfLiteSignatureRunnerGetInputName
3474 .as_ref()
3475 .expect("Expected function, got error."))(signature_runner, input_index)
3476 }
3477 }
3478
3479 #[doc = " Resizes the input tensor identified as `input_name` to be the dimensions\n specified by `input_dims` and `input_dims_size`. Only unknown dimensions can\n be resized with this function. Unknown dimensions are indicated as `-1` in\n the `dims_signature` attribute of a TfLiteTensor.\n\n Returns status of failure or success. Note that this doesn't actually resize\n any existing buffers. A call to TfLiteSignatureRunnerAllocateTensors() is\n required to change the tensor input buffer.\n\n NOTE: This function is similar to TfLiteInterpreterResizeInputTensorStrict()\n and not TfLiteInterpreterResizeInputTensor().\n\n NOTE: `input_name` must match the name of an input in the signature.\n\n NOTE: This function makes a copy of the input dimensions, so the caller can\n safely deallocate `input_dims` immediately after this function returns."]
3480 pub unsafe fn TfLiteSignatureRunnerResizeInputTensor(
3481 &self,
3482 signature_runner: *mut TfLiteSignatureRunner,
3483 input_name: *const ::std::os::raw::c_char,
3484 input_dims: *const ::std::os::raw::c_int,
3485 input_dims_size: i32,
3486 ) -> TfLiteStatus {
3487 unsafe {
3488 (self
3489 .TfLiteSignatureRunnerResizeInputTensor
3490 .as_ref()
3491 .expect("Expected function, got error."))(
3492 signature_runner,
3493 input_name,
3494 input_dims,
3495 input_dims_size,
3496 )
3497 }
3498 }
3499
3500 #[doc = " Updates allocations for tensors associated with a signature and resizes\n dependent tensors using the specified input tensor dimensionality.\n This is a relatively expensive operation and hence should only be called\n after initializing the signature runner object and/or resizing any inputs."]
3501 pub unsafe fn TfLiteSignatureRunnerAllocateTensors(
3502 &self,
3503 signature_runner: *mut TfLiteSignatureRunner,
3504 ) -> TfLiteStatus {
3505 unsafe {
3506 (self
3507 .TfLiteSignatureRunnerAllocateTensors
3508 .as_ref()
3509 .expect("Expected function, got error."))(signature_runner)
3510 }
3511 }
3512
3513 #[doc = " Returns the input tensor identified by `input_name` in the given signature.\n Returns nullptr if the given name is not valid.\n\n NOTE: The lifetime of the returned tensor is the same as (and depends on)\n the lifetime of `signature_runner`."]
3514 pub unsafe fn TfLiteSignatureRunnerGetInputTensor(
3515 &self,
3516 signature_runner: *mut TfLiteSignatureRunner,
3517 input_name: *const ::std::os::raw::c_char,
3518 ) -> *mut TfLiteTensor {
3519 unsafe {
3520 (self
3521 .TfLiteSignatureRunnerGetInputTensor
3522 .as_ref()
3523 .expect("Expected function, got error."))(signature_runner, input_name)
3524 }
3525 }
3526
3527 #[doc = " Runs inference on a given signature.\n\n Before calling this function, the caller should first invoke\n TfLiteSignatureRunnerAllocateTensors() and should also set the values for\n the input tensors. After successfully calling this function, the values for\n the output tensors will be set."]
3528 pub unsafe fn TfLiteSignatureRunnerInvoke(
3529 &self,
3530 signature_runner: *mut TfLiteSignatureRunner,
3531 ) -> TfLiteStatus {
3532 unsafe {
3533 (self
3534 .TfLiteSignatureRunnerInvoke
3535 .as_ref()
3536 .expect("Expected function, got error."))(signature_runner)
3537 }
3538 }
3539
3540 #[doc = " Returns the number of output tensors associated with the signature."]
3541 pub unsafe fn TfLiteSignatureRunnerGetOutputCount(
3542 &self,
3543 signature_runner: *const TfLiteSignatureRunner,
3544 ) -> usize {
3545 unsafe {
3546 (self
3547 .TfLiteSignatureRunnerGetOutputCount
3548 .as_ref()
3549 .expect("Expected function, got error."))(signature_runner)
3550 }
3551 }
3552
3553 #[doc = " Returns the (null-terminated) name of the Nth output in a signature, where\n N is specified as `output_index`.\n\n NOTE: The lifetime of the returned name is the same as (and depends on) the\n lifetime of `signature_runner`."]
3554 pub unsafe fn TfLiteSignatureRunnerGetOutputName(
3555 &self,
3556 signature_runner: *const TfLiteSignatureRunner,
3557 output_index: i32,
3558 ) -> *const ::std::os::raw::c_char {
3559 unsafe {
3560 (self
3561 .TfLiteSignatureRunnerGetOutputName
3562 .as_ref()
3563 .expect("Expected function, got error."))(signature_runner, output_index)
3564 }
3565 }
3566
3567 #[doc = " Returns the output tensor identified by `output_name` in the given\n signature. Returns nullptr if the given name is not valid.\n\n NOTE: The lifetime of the returned tensor is the same as (and depends on)\n the lifetime of `signature_runner`."]
3568 pub unsafe fn TfLiteSignatureRunnerGetOutputTensor(
3569 &self,
3570 signature_runner: *const TfLiteSignatureRunner,
3571 output_name: *const ::std::os::raw::c_char,
3572 ) -> *const TfLiteTensor {
3573 unsafe {
3574 (self
3575 .TfLiteSignatureRunnerGetOutputTensor
3576 .as_ref()
3577 .expect("Expected function, got error."))(signature_runner, output_name)
3578 }
3579 }
3580
3581 #[doc = " Returns the type of a tensor element."]
3582 pub unsafe fn TfLiteTensorType(&self, tensor: *const TfLiteTensor) -> TfLiteType {
3583 unsafe {
3584 (self
3585 .TfLiteTensorType
3586 .as_ref()
3587 .expect("Expected function, got error."))(tensor)
3588 }
3589 }
3590
3591 #[doc = " Returns the number of dimensions that the tensor has. Returns -1 in case\n the 'opaque_tensor' does not have its dimensions property set."]
3592 pub unsafe fn TfLiteTensorNumDims(&self, tensor: *const TfLiteTensor) -> i32 {
3593 unsafe {
3594 (self
3595 .TfLiteTensorNumDims
3596 .as_ref()
3597 .expect("Expected function, got error."))(tensor)
3598 }
3599 }
3600
3601 #[doc = " Returns the length of the tensor in the \"dim_index\" dimension.\n REQUIRES: 0 <= dim_index < TFLiteTensorNumDims(tensor)"]
3602 pub unsafe fn TfLiteTensorDim(&self, tensor: *const TfLiteTensor, dim_index: i32) -> i32 {
3603 unsafe {
3604 (self
3605 .TfLiteTensorDim
3606 .as_ref()
3607 .expect("Expected function, got error."))(tensor, dim_index)
3608 }
3609 }
3610
3611 #[doc = " Returns the size of the underlying data in bytes."]
3612 pub unsafe fn TfLiteTensorByteSize(&self, tensor: *const TfLiteTensor) -> usize {
3613 unsafe {
3614 (self
3615 .TfLiteTensorByteSize
3616 .as_ref()
3617 .expect("Expected function, got error."))(tensor)
3618 }
3619 }
3620
3621 #[doc = " Returns a pointer to the underlying data buffer.\n\n \\note The result may be null if tensors have not yet been allocated, e.g.,\n if the Tensor has just been created or resized and `TfLiteAllocateTensors()`\n has yet to be called, or if the output tensor is dynamically sized and the\n interpreter hasn't been invoked."]
3622 pub unsafe fn TfLiteTensorData(
3623 &self,
3624 tensor: *const TfLiteTensor,
3625 ) -> *mut ::std::os::raw::c_void {
3626 unsafe {
3627 (self
3628 .TfLiteTensorData
3629 .as_ref()
3630 .expect("Expected function, got error."))(tensor)
3631 }
3632 }
3633
3634 #[doc = " Returns the (null-terminated) name of the tensor."]
3635 pub unsafe fn TfLiteTensorName(
3636 &self,
3637 tensor: *const TfLiteTensor,
3638 ) -> *const ::std::os::raw::c_char {
3639 unsafe {
3640 (self
3641 .TfLiteTensorName
3642 .as_ref()
3643 .expect("Expected function, got error."))(tensor)
3644 }
3645 }
3646
3647 #[doc = " Returns the parameters for asymmetric quantization. The quantization\n parameters are only valid when the tensor type is `kTfLiteUInt8` and the\n `scale != 0`. Quantized values can be converted back to float using:\n real_value = scale * (quantized_value - zero_point);"]
3648 pub unsafe fn TfLiteTensorQuantizationParams(
3649 &self,
3650 tensor: *const TfLiteTensor,
3651 ) -> TfLiteQuantizationParams {
3652 unsafe {
3653 (self
3654 .TfLiteTensorQuantizationParams
3655 .as_ref()
3656 .expect("Expected function, got error."))(tensor)
3657 }
3658 }
3659
3660 #[doc = " Copies from the provided input buffer into the tensor's buffer.\n REQUIRES: input_data_size == TfLiteTensorByteSize(tensor)"]
3661 pub unsafe fn TfLiteTensorCopyFromBuffer(
3662 &self,
3663 tensor: *mut TfLiteTensor,
3664 input_data: *const ::std::os::raw::c_void,
3665 input_data_size: usize,
3666 ) -> TfLiteStatus {
3667 unsafe {
3668 (self
3669 .TfLiteTensorCopyFromBuffer
3670 .as_ref()
3671 .expect("Expected function, got error."))(
3672 tensor, input_data, input_data_size
3673 )
3674 }
3675 }
3676
3677 #[doc = " Copies to the provided output buffer from the tensor's buffer.\n REQUIRES: output_data_size == TfLiteTensorByteSize(tensor)"]
3678 pub unsafe fn TfLiteTensorCopyToBuffer(
3679 &self,
3680 output_tensor: *const TfLiteTensor,
3681 output_data: *mut ::std::os::raw::c_void,
3682 output_data_size: usize,
3683 ) -> TfLiteStatus {
3684 unsafe {
3685 (self
3686 .TfLiteTensorCopyToBuffer
3687 .as_ref()
3688 .expect("Expected function, got error."))(
3689 output_tensor,
3690 output_data,
3691 output_data_size,
3692 )
3693 }
3694 }
3695
3696 #[doc = " Destroys the signature runner."]
3697 pub unsafe fn TfLiteSignatureRunnerDelete(&self, signature_runner: *mut TfLiteSignatureRunner) {
3698 unsafe {
3699 (self
3700 .TfLiteSignatureRunnerDelete
3701 .as_ref()
3702 .expect("Expected function, got error."))(signature_runner)
3703 }
3704 }
3705
3706 #[doc = " Given the size (number of elements) in a TfLiteIntArray, calculate its size\n in bytes."]
3707 pub unsafe fn TfLiteIntArrayGetSizeInBytes(&self, size: ::std::os::raw::c_int) -> usize {
3708 unsafe {
3709 (self
3710 .TfLiteIntArrayGetSizeInBytes
3711 .as_ref()
3712 .expect("Expected function, got error."))(size)
3713 }
3714 }
3715
3716 #[doc = " Create a array of a given `size` (uninitialized entries).\n This returns a pointer, that you must free using TfLiteIntArrayFree()."]
3717 pub unsafe fn TfLiteIntArrayCreate(&self, size: ::std::os::raw::c_int) -> *mut TfLiteIntArray {
3718 unsafe {
3719 (self
3720 .TfLiteIntArrayCreate
3721 .as_ref()
3722 .expect("Expected function, got error."))(size)
3723 }
3724 }
3725
3726 #[doc = " Check if two intarrays are equal. Returns 1 if they are equal, 0 otherwise."]
3727 pub unsafe fn TfLiteIntArrayEqual(
3728 &self,
3729 a: *const TfLiteIntArray,
3730 b: *const TfLiteIntArray,
3731 ) -> ::std::os::raw::c_int {
3732 unsafe {
3733 (self
3734 .TfLiteIntArrayEqual
3735 .as_ref()
3736 .expect("Expected function, got error."))(a, b)
3737 }
3738 }
3739
3740 #[doc = " Check if an intarray equals an array. Returns 1 if equals, 0 otherwise."]
3741 pub unsafe fn TfLiteIntArrayEqualsArray(
3742 &self,
3743 a: *const TfLiteIntArray,
3744 b_size: ::std::os::raw::c_int,
3745 b_data: *const ::std::os::raw::c_int,
3746 ) -> ::std::os::raw::c_int {
3747 unsafe {
3748 (self
3749 .TfLiteIntArrayEqualsArray
3750 .as_ref()
3751 .expect("Expected function, got error."))(a, b_size, b_data)
3752 }
3753 }
3754
3755 #[doc = " Create a copy of an array passed as `src`.\n You are expected to free memory with TfLiteIntArrayFree"]
3756 pub unsafe fn TfLiteIntArrayCopy(&self, src: *const TfLiteIntArray) -> *mut TfLiteIntArray {
3757 unsafe {
3758 (self
3759 .TfLiteIntArrayCopy
3760 .as_ref()
3761 .expect("Expected function, got error."))(src)
3762 }
3763 }
3764
3765 #[doc = " Free memory of array `a`."]
3766 pub unsafe fn TfLiteIntArrayFree(&self, a: *mut TfLiteIntArray) {
3767 unsafe {
3768 (self
3769 .TfLiteIntArrayFree
3770 .as_ref()
3771 .expect("Expected function, got error."))(a)
3772 }
3773 }
3774
3775 #[doc = " Given the size (number of elements) in a TfLiteFloatArray, calculate its\n size in bytes."]
3776 pub unsafe fn TfLiteFloatArrayGetSizeInBytes(
3777 &self,
3778 size: ::std::os::raw::c_int,
3779 ) -> ::std::os::raw::c_int {
3780 unsafe {
3781 (self
3782 .TfLiteFloatArrayGetSizeInBytes
3783 .as_ref()
3784 .expect("Expected function, got error."))(size)
3785 }
3786 }
3787
3788 #[doc = " Create a array of a given `size` (uninitialized entries).\n This returns a pointer, that you must free using TfLiteFloatArrayFree()."]
3789 pub unsafe fn TfLiteFloatArrayCreate(
3790 &self,
3791 size: ::std::os::raw::c_int,
3792 ) -> *mut TfLiteFloatArray {
3793 unsafe {
3794 (self
3795 .TfLiteFloatArrayCreate
3796 .as_ref()
3797 .expect("Expected function, got error."))(size)
3798 }
3799 }
3800
3801 #[doc = " Create a copy of an array passed as `src`.\n You are expected to free memory with TfLiteFloatArrayFree."]
3802 pub unsafe fn TfLiteFloatArrayCopy(
3803 &self,
3804 src: *const TfLiteFloatArray,
3805 ) -> *mut TfLiteFloatArray {
3806 unsafe {
3807 (self
3808 .TfLiteFloatArrayCopy
3809 .as_ref()
3810 .expect("Expected function, got error."))(src)
3811 }
3812 }
3813
3814 #[doc = " Free memory of array `a`."]
3815 pub unsafe fn TfLiteFloatArrayFree(&self, a: *mut TfLiteFloatArray) {
3816 unsafe {
3817 (self
3818 .TfLiteFloatArrayFree
3819 .as_ref()
3820 .expect("Expected function, got error."))(a)
3821 }
3822 }
3823
3824 #[doc = " Return the name of a given type, for error reporting purposes."]
3825 pub unsafe fn TfLiteTypeGetName(&self, type_: TfLiteType) -> *const ::std::os::raw::c_char {
3826 unsafe {
3827 (self
3828 .TfLiteTypeGetName
3829 .as_ref()
3830 .expect("Expected function, got error."))(type_)
3831 }
3832 }
3833
3834 #[doc = " Free data memory of tensor `t`."]
3835 pub unsafe fn TfLiteTensorDataFree(&self, t: *mut TfLiteTensor) {
3836 unsafe {
3837 (self
3838 .TfLiteTensorDataFree
3839 .as_ref()
3840 .expect("Expected function, got error."))(t)
3841 }
3842 }
3843
3844 #[doc = " Free quantization data."]
3845 pub unsafe fn TfLiteQuantizationFree(&self, quantization: *mut TfLiteQuantization) {
3846 unsafe {
3847 (self
3848 .TfLiteQuantizationFree
3849 .as_ref()
3850 .expect("Expected function, got error."))(quantization)
3851 }
3852 }
3853
3854 #[doc = " Free sparsity parameters."]
3855 pub unsafe fn TfLiteSparsityFree(&self, sparsity: *mut TfLiteSparsity) {
3856 unsafe {
3857 (self
3858 .TfLiteSparsityFree
3859 .as_ref()
3860 .expect("Expected function, got error."))(sparsity)
3861 }
3862 }
3863
3864 #[doc = " Free memory of tensor `t`."]
3865 pub unsafe fn TfLiteTensorFree(&self, t: *mut TfLiteTensor) {
3866 unsafe {
3867 (self
3868 .TfLiteTensorFree
3869 .as_ref()
3870 .expect("Expected function, got error."))(t)
3871 }
3872 }
3873
3874 #[doc = " Set all of a tensor's fields (and free any previously allocated data)."]
3875 pub unsafe fn TfLiteTensorReset(
3876 &self,
3877 type_: TfLiteType,
3878 name: *const ::std::os::raw::c_char,
3879 dims: *mut TfLiteIntArray,
3880 quantization: TfLiteQuantizationParams,
3881 buffer: *mut ::std::os::raw::c_char,
3882 size: usize,
3883 allocation_type: TfLiteAllocationType,
3884 allocation: *const ::std::os::raw::c_void,
3885 is_variable: bool,
3886 tensor: *mut TfLiteTensor,
3887 ) {
3888 unsafe {
3889 (self
3890 .TfLiteTensorReset
3891 .as_ref()
3892 .expect("Expected function, got error."))(
3893 type_,
3894 name,
3895 dims,
3896 quantization,
3897 buffer,
3898 size,
3899 allocation_type,
3900 allocation,
3901 is_variable,
3902 tensor,
3903 )
3904 }
3905 }
3906
3907 #[doc = " Copies the contents of `src` in `dst`.\n Function does nothing if either `src` or `dst` is passed as nullptr and\n return `kTfLiteOk`.\n Returns `kTfLiteError` if `src` and `dst` doesn't have matching data size.\n Note function copies contents, so it won't create new data pointer\n or change allocation type.\n All Tensor related properties will be copied from `src` to `dst` like\n quantization, sparsity, ..."]
3908 pub unsafe fn TfLiteTensorCopy(
3909 &self,
3910 src: *const TfLiteTensor,
3911 dst: *mut TfLiteTensor,
3912 ) -> TfLiteStatus {
3913 unsafe {
3914 (self
3915 .TfLiteTensorCopy
3916 .as_ref()
3917 .expect("Expected function, got error."))(src, dst)
3918 }
3919 }
3920
3921 #[doc = " Change the size of the memory block owned by `tensor` to `num_bytes`.\n Tensors with allocation types other than `kTfLiteDynamic` will be ignored\n and a `kTfLiteOk` will be returned. `tensor`'s internal data buffer will be\n assigned a pointer which can safely be passed to free or realloc if\n `num_bytes` is zero. If `preserve_data` is true, tensor data will be\n unchanged in the range from the start of the region up to the minimum of the\n old and new sizes. In the case of NULL tensor, or an error allocating new\n memory, returns `kTfLiteError`."]
3922 pub unsafe fn TfLiteTensorResizeMaybeCopy(
3923 &self,
3924 num_bytes: usize,
3925 tensor: *mut TfLiteTensor,
3926 preserve_data: bool,
3927 ) -> TfLiteStatus {
3928 unsafe {
3929 (self
3930 .TfLiteTensorResizeMaybeCopy
3931 .as_ref()
3932 .expect("Expected function, got error."))(
3933 num_bytes, tensor, preserve_data
3934 )
3935 }
3936 }
3937
3938 #[doc = " Change the size of the memory block owned by `tensor` to `num_bytes`.\n Tensors with allocation types other than `kTfLiteDynamic` will be ignored\n and a `kTfLiteOk` will be returned. `tensor`'s internal data buffer will be\n assigned a pointer which can safely be passed to free or realloc if\n `num_bytes` is zero. Tensor data will be unchanged in the range from the\n start of the region up to the minimum of the old and new sizes. In the case\n of NULL tensor, or an error allocating new memory, returns `kTfLiteError`."]
3939 pub unsafe fn TfLiteTensorRealloc(
3940 &self,
3941 num_bytes: usize,
3942 tensor: *mut TfLiteTensor,
3943 ) -> TfLiteStatus {
3944 unsafe {
3945 (self
3946 .TfLiteTensorRealloc
3947 .as_ref()
3948 .expect("Expected function, got error."))(num_bytes, tensor)
3949 }
3950 }
3951
3952 #[doc = " Build a `null` delegate, with all the fields properly set to their default\n values."]
3953 pub unsafe fn TfLiteDelegateCreate(&self) -> TfLiteDelegate {
3954 unsafe {
3955 (self
3956 .TfLiteDelegateCreate
3957 .as_ref()
3958 .expect("Expected function, got error."))()
3959 }
3960 }
3961
3962 #[doc = " Creates an opaque delegate and returns its address. The opaque delegate\n will behave according to the provided `opaque_delegate_builder`. The\n lifetime of the objects pointed to by any of the fields within the\n `opaque_delegate_builder` must outlive the returned\n `TfLiteOpaqueDelegate` and any `TfLiteInterpreter`,\n `TfLiteInterpreterOptions`, `tflite::Interpreter`, or\n `tflite::InterpreterBuilder` that the delegate is added to. The returned\n address should be passed to `TfLiteOpaqueDelegateDelete` for deletion. If\n `opaque_delegate_builder` is a null pointer, then a null pointer will be\n returned."]
3963 pub unsafe fn TfLiteOpaqueDelegateCreate(
3964 &self,
3965 opaque_delegate_builder: *const TfLiteOpaqueDelegateBuilder,
3966 ) -> *mut TfLiteOpaqueDelegate {
3967 unsafe {
3968 (self
3969 .TfLiteOpaqueDelegateCreate
3970 .as_ref()
3971 .expect("Expected function, got error."))(opaque_delegate_builder)
3972 }
3973 }
3974
3975 #[doc = " Deletes the provided opaque `delegate`. This function has no effect if the\n `delegate` is a null pointer."]
3976 pub unsafe fn TfLiteOpaqueDelegateDelete(&self, delegate: *mut TfLiteOpaqueDelegate) {
3977 unsafe {
3978 (self
3979 .TfLiteOpaqueDelegateDelete
3980 .as_ref()
3981 .expect("Expected function, got error."))(delegate)
3982 }
3983 }
3984
3985 #[doc = " Returns a pointer to the data associated with the provided opaque\n `delegate`.\n\n A null pointer will be returned when:\n - The `delegate` is null.\n - The `data` field of the `TfLiteOpaqueDelegateBuilder` used to construct\n the `delegate` was null.\n - Or in case of any other error.\n - The `delegate` has been constructed via a `TfLiteOpaqueDelegateBuilder`,\n but the `data` field of the `TfLiteOpaqueDelegateBuilder` is null.\n\n The data_ field of `delegate` will be returned if the\n `opaque_delegate_builder` field is null."]
3986 pub unsafe fn TfLiteOpaqueDelegateGetData(
3987 &self,
3988 delegate: *const TfLiteOpaqueDelegate,
3989 ) -> *mut ::std::os::raw::c_void {
3990 unsafe {
3991 (self
3992 .TfLiteOpaqueDelegateGetData
3993 .as_ref()
3994 .expect("Expected function, got error."))(delegate)
3995 }
3996 }
3997
3998 #[doc = " Returns a tensor data allocation strategy."]
3999 pub unsafe fn TfLiteTensorGetAllocationStrategy(
4000 &self,
4001 t: *const TfLiteTensor,
4002 ) -> TfLiteAllocationStrategy {
4003 unsafe {
4004 (self
4005 .TfLiteTensorGetAllocationStrategy
4006 .as_ref()
4007 .expect("Expected function, got error."))(t)
4008 }
4009 }
4010
4011 #[doc = " Returns how stable a tensor data buffer address is across runs."]
4012 pub unsafe fn TfLiteTensorGetBufferAddressStability(
4013 &self,
4014 t: *const TfLiteTensor,
4015 ) -> TfLiteRunStability {
4016 unsafe {
4017 (self
4018 .TfLiteTensorGetBufferAddressStability
4019 .as_ref()
4020 .expect("Expected function, got error."))(t)
4021 }
4022 }
4023
4024 #[doc = " Returns how stable a tensor data values are across runs."]
4025 pub unsafe fn TfLiteTensorGetDataStability(
4026 &self,
4027 t: *const TfLiteTensor,
4028 ) -> TfLiteRunStability {
4029 unsafe {
4030 (self
4031 .TfLiteTensorGetDataStability
4032 .as_ref()
4033 .expect("Expected function, got error."))(t)
4034 }
4035 }
4036
4037 #[doc = " Returns the operation step when the data of a tensor is populated.\n\n Some operations can precompute their results before the evaluation step.\n This makes the data available earlier for subsequent operations."]
4038 pub unsafe fn TfLiteTensorGetDataKnownStep(&self, t: *const TfLiteTensor) -> TfLiteRunStep {
4039 unsafe {
4040 (self
4041 .TfLiteTensorGetDataKnownStep
4042 .as_ref()
4043 .expect("Expected function, got error."))(t)
4044 }
4045 }
4046
4047 #[doc = " Returns the operation steop when the shape of a tensor is computed.\n\n Some operations can precompute the shape of their results before the\n evaluation step. This makes the shape available earlier for subsequent\n operations."]
4048 pub unsafe fn TfLiteTensorGetShapeKnownStep(&self, t: *const TfLiteTensor) -> TfLiteRunStep {
4049 unsafe {
4050 (self
4051 .TfLiteTensorGetShapeKnownStep
4052 .as_ref()
4053 .expect("Expected function, got error."))(t)
4054 }
4055 }
4056
4057 #[doc = " Returns the type of a tensor element."]
4058 pub unsafe fn TfLiteOpaqueTensorType(
4059 &self,
4060 opaque_tensor: *const TfLiteOpaqueTensor,
4061 ) -> TfLiteType {
4062 unsafe {
4063 (self
4064 .TfLiteOpaqueTensorType
4065 .as_ref()
4066 .expect("Expected function, got error."))(opaque_tensor)
4067 }
4068 }
4069
4070 #[doc = " Returns the number of dimensions that the tensor has. Returns -1 in case\n the 'opaque_tensor' does not have its dimensions property set."]
4071 pub unsafe fn TfLiteOpaqueTensorNumDims(
4072 &self,
4073 opaque_tensor: *const TfLiteOpaqueTensor,
4074 ) -> i32 {
4075 unsafe {
4076 (self
4077 .TfLiteOpaqueTensorNumDims
4078 .as_ref()
4079 .expect("Expected function, got error."))(opaque_tensor)
4080 }
4081 }
4082
4083 #[doc = " Returns the length of the tensor in the \"dim_index\" dimension."]
4084 pub unsafe fn TfLiteOpaqueTensorDim(
4085 &self,
4086 opaque_tensor: *const TfLiteOpaqueTensor,
4087 dim_index: i32,
4088 ) -> i32 {
4089 unsafe {
4090 (self
4091 .TfLiteOpaqueTensorDim
4092 .as_ref()
4093 .expect("Expected function, got error."))(opaque_tensor, dim_index)
4094 }
4095 }
4096
4097 #[doc = " Loads into the provided 'num_dims' the number of dimensions that the\n tensor's signature has. Returns 'kTfLiteOk' if 'num_dims' was successfully\n loaded. Any other return code indicates an error and 'num_dims' won't be\n loaded.\n\n A tensor's dimension signature encodes shapes with unknown dimensions with\n -1. E.g. for a tensor with three dimensions, whose first dimension has an\n unknown size, and the second and third dimension have a size of 2, the\n dimension signature is [-1,2,2], and 'TfLiteOpaqueTensorGetNumDimsSignature'\n loads 3 into 'num_dims'. If the tensor does not have its dimension signature\n field set then 'num_dims' is set to -1."]
4098 pub unsafe fn TfLiteOpaqueTensorGetNumDimsSignature(
4099 &self,
4100 opaque_tensor: *const TfLiteOpaqueTensor,
4101 num_dims: *mut i32,
4102 ) -> TfLiteStatus {
4103 unsafe {
4104 (self
4105 .TfLiteOpaqueTensorGetNumDimsSignature
4106 .as_ref()
4107 .expect("Expected function, got error."))(opaque_tensor, num_dims)
4108 }
4109 }
4110
4111 #[doc = " Loads into the provided 'dim_length' the length of the tensor in the\n 'dim_index' signature dimension or -1 if that dimension has unknown length.\n Returns 'kTfLiteOk' if 'dim_length' was successfully loaded. Any\n other return code indicates an error and 'dim_length' won't be loaded."]
4112 pub unsafe fn TfLiteOpaqueTensorGetDimSignature(
4113 &self,
4114 opaque_tensor: *const TfLiteOpaqueTensor,
4115 dim_index: i32,
4116 dim_length: *mut i32,
4117 ) -> TfLiteStatus {
4118 unsafe {
4119 (self
4120 .TfLiteOpaqueTensorGetDimSignature
4121 .as_ref()
4122 .expect("Expected function, got error."))(
4123 opaque_tensor, dim_index, dim_length
4124 )
4125 }
4126 }
4127
4128 #[doc = " Returns 'non-zero' if the provided 'opaque_tensor' is a variable, and\n returns zero otherwise."]
4129 pub unsafe fn TfLiteOpaqueTensorIsVariable(
4130 &self,
4131 opaque_tensor: *const TfLiteOpaqueTensor,
4132 ) -> ::std::os::raw::c_int {
4133 unsafe {
4134 (self
4135 .TfLiteOpaqueTensorIsVariable
4136 .as_ref()
4137 .expect("Expected function, got error."))(opaque_tensor)
4138 }
4139 }
4140
4141 #[doc = " Returns the size of the underlying data in bytes."]
4142 pub unsafe fn TfLiteOpaqueTensorByteSize(
4143 &self,
4144 opaque_tensor: *const TfLiteOpaqueTensor,
4145 ) -> usize {
4146 unsafe {
4147 (self
4148 .TfLiteOpaqueTensorByteSize
4149 .as_ref()
4150 .expect("Expected function, got error."))(opaque_tensor)
4151 }
4152 }
4153
4154 #[doc = " Returns a pointer to the underlying data buffer.\n Returns nullptr if input is also nullptr."]
4155 pub unsafe fn TfLiteOpaqueTensorData(
4156 &self,
4157 opaque_tensor: *const TfLiteOpaqueTensor,
4158 ) -> *mut ::std::os::raw::c_void {
4159 unsafe {
4160 (self
4161 .TfLiteOpaqueTensorData
4162 .as_ref()
4163 .expect("Expected function, got error."))(opaque_tensor)
4164 }
4165 }
4166
4167 #[doc = " Returns the 'opaque_tensor's allocation type."]
4168 pub unsafe fn TfLiteOpaqueTensorGetAllocationType(
4169 &self,
4170 opaque_tensor: *const TfLiteOpaqueTensor,
4171 ) -> TfLiteAllocationType {
4172 unsafe {
4173 (self
4174 .TfLiteOpaqueTensorGetAllocationType
4175 .as_ref()
4176 .expect("Expected function, got error."))(opaque_tensor)
4177 }
4178 }
4179
4180 #[doc = " Returns a tensor data allocation strategy."]
4181 pub unsafe fn TfLiteOpaqueTensorGetAllocationStrategy(
4182 &self,
4183 t: *const TfLiteOpaqueTensor,
4184 ) -> TfLiteAllocationStrategy {
4185 unsafe {
4186 (self
4187 .TfLiteOpaqueTensorGetAllocationStrategy
4188 .as_ref()
4189 .expect("Expected function, got error."))(t)
4190 }
4191 }
4192
4193 #[doc = " Returns how stable a tensor data buffer address is across runs."]
4194 pub unsafe fn TfLiteOpaqueTensorGetBufferAddressStability(
4195 &self,
4196 t: *const TfLiteOpaqueTensor,
4197 ) -> TfLiteRunStability {
4198 unsafe {
4199 (self
4200 .TfLiteOpaqueTensorGetBufferAddressStability
4201 .as_ref()
4202 .expect("Expected function, got error."))(t)
4203 }
4204 }
4205
4206 #[doc = " Returns how stable a tensor data values are across runs."]
4207 pub unsafe fn TfLiteOpaqueTensorGetDataStability(
4208 &self,
4209 t: *const TfLiteOpaqueTensor,
4210 ) -> TfLiteRunStability {
4211 unsafe {
4212 (self
4213 .TfLiteOpaqueTensorGetDataStability
4214 .as_ref()
4215 .expect("Expected function, got error."))(t)
4216 }
4217 }
4218
4219 #[doc = " Returns the operation step when the data of a tensor is populated."]
4220 pub unsafe fn TfLiteOpaqueTensorGetDataKnownStep(
4221 &self,
4222 t: *const TfLiteOpaqueTensor,
4223 ) -> TfLiteRunStep {
4224 unsafe {
4225 (self
4226 .TfLiteOpaqueTensorGetDataKnownStep
4227 .as_ref()
4228 .expect("Expected function, got error."))(t)
4229 }
4230 }
4231
4232 #[doc = " Returns the operation step when the shape of a tensor is computed."]
4233 pub unsafe fn TfLiteOpaqueTensorGetShapeKnownStep(
4234 &self,
4235 t: *const TfLiteOpaqueTensor,
4236 ) -> TfLiteRunStep {
4237 unsafe {
4238 (self
4239 .TfLiteOpaqueTensorGetShapeKnownStep
4240 .as_ref()
4241 .expect("Expected function, got error."))(t)
4242 }
4243 }
4244
4245 #[doc = " Returns the (null-terminated) name of the tensor."]
4246 pub unsafe fn TfLiteOpaqueTensorName(
4247 &self,
4248 opaque_tensor: *const TfLiteOpaqueTensor,
4249 ) -> *const ::std::os::raw::c_char {
4250 unsafe {
4251 (self
4252 .TfLiteOpaqueTensorName
4253 .as_ref()
4254 .expect("Expected function, got error."))(opaque_tensor)
4255 }
4256 }
4257
4258 #[doc = " Returns the 'opaque_tensor's quantization information."]
4259 pub unsafe fn TfLiteOpaqueTensorGetQuantization(
4260 &self,
4261 opaque_tensor: *const TfLiteOpaqueTensor,
4262 ) -> TfLiteQuantization {
4263 unsafe {
4264 (self
4265 .TfLiteOpaqueTensorGetQuantization
4266 .as_ref()
4267 .expect("Expected function, got error."))(opaque_tensor)
4268 }
4269 }
4270
4271 #[doc = " Returns the 'opaque_tensor's quantization parameters."]
4272 pub unsafe fn TfLiteOpaqueTensorGetQuantizationParams(
4273 &self,
4274 opaque_tensor: *const TfLiteOpaqueTensor,
4275 ) -> TfLiteQuantizationParams {
4276 unsafe {
4277 (self
4278 .TfLiteOpaqueTensorGetQuantizationParams
4279 .as_ref()
4280 .expect("Expected function, got error."))(opaque_tensor)
4281 }
4282 }
4283
4284 #[doc = " Copies from the provided input buffer into the tensor's buffer."]
4285 pub unsafe fn TfLiteOpaqueTensorCopyFromBuffer(
4286 &self,
4287 opaque_tensor: *mut TfLiteOpaqueTensor,
4288 input_data: *const ::std::os::raw::c_void,
4289 input_data_size: usize,
4290 ) -> TfLiteStatus {
4291 unsafe {
4292 (self
4293 .TfLiteOpaqueTensorCopyFromBuffer
4294 .as_ref()
4295 .expect("Expected function, got error."))(
4296 opaque_tensor,
4297 input_data,
4298 input_data_size,
4299 )
4300 }
4301 }
4302
4303 #[doc = " Copies to the provided output buffer from the tensor's buffer."]
4304 pub unsafe fn TfLiteOpaqueTensorCopyToBuffer(
4305 &self,
4306 opaque_tensor: *const TfLiteOpaqueTensor,
4307 output_data: *mut ::std::os::raw::c_void,
4308 output_data_size: usize,
4309 ) -> TfLiteStatus {
4310 unsafe {
4311 (self
4312 .TfLiteOpaqueTensorCopyToBuffer
4313 .as_ref()
4314 .expect("Expected function, got error."))(
4315 opaque_tensor,
4316 output_data,
4317 output_data_size,
4318 )
4319 }
4320 }
4321
4322 #[doc = " Returns the number of strings stored in the provided 'tensor'.\n Returns -1 in case of failure."]
4323 pub unsafe fn TfLiteOpaqueTensorGetStringCount(
4324 &self,
4325 tensor: *const TfLiteOpaqueTensor,
4326 ) -> ::std::os::raw::c_int {
4327 unsafe {
4328 (self
4329 .TfLiteOpaqueTensorGetStringCount
4330 .as_ref()
4331 .expect("Expected function, got error."))(tensor)
4332 }
4333 }
4334
4335 #[doc = " Stores the address of the n-th (denoted by the provided 'index') string\n contained in the provided 'tensor' in the provided '*str' pointer. Stores\n the length of the string in the provided '*len' argument.\n\n Returns 'kTfLiteOk' if '*str' and '*len' have been set successfully. Any\n other return value indicates a failure, which leaves '*str' and '*len' in an\n unspecified state.\n\n The range of valid indices is defined by the half open interval [0, N),\n where N == TfLiteOpaqueTensorGetStringCount(tensor).\n\n Note that 'str' is not guaranteed to be null-terminated. Also note that this\n function will not create a copy of the underlying string data. The data is\n owned by the 'tensor'."]
4336 pub unsafe fn TfLiteOpaqueTensorGetString(
4337 &self,
4338 tensor: *const TfLiteOpaqueTensor,
4339 index: ::std::os::raw::c_int,
4340 str_: *mut *const ::std::os::raw::c_char,
4341 len: *mut ::std::os::raw::c_int,
4342 ) -> TfLiteStatus {
4343 unsafe {
4344 (self
4345 .TfLiteOpaqueTensorGetString
4346 .as_ref()
4347 .expect("Expected function, got error."))(tensor, index, str_, len)
4348 }
4349 }
4350
4351 #[doc = " Writes the array of strings specified by 'str_array' into\n the specified 'tensor'. The strings provided via the 'str_array' are being\n copied into the 'tensor'. Returns 'kTfLiteOk' in case of success. Any other\n return value indicates a failure.\n\n The provided 'str_array_len' must denote the length of 'str_array'\n and 'str_n_len[i]' must denote the length of the i-th string.\n\n The provided strings don't need to be null terminated and may contain\n embedded null characters. The amount of bytes copied into the 'tensor' is\n entirely determined by 'str_n_len[i]' and it is the caller's responsibility\n to set this value correctly to avoid undefined behavior.\n\n Also note that calling 'TfLiteOpaqueTensorWriteStrings' deallocates any\n previously stored data in the 'tensor'."]
4352 pub unsafe fn TfLiteOpaqueTensorWriteStrings(
4353 &self,
4354 tensor: *mut TfLiteOpaqueTensor,
4355 str_array: *const *const ::std::os::raw::c_char,
4356 str_array_len: ::std::os::raw::c_int,
4357 str_n_len: *const ::std::os::raw::c_int,
4358 ) -> TfLiteStatus {
4359 unsafe {
4360 (self
4361 .TfLiteOpaqueTensorWriteStrings
4362 .as_ref()
4363 .expect("Expected function, got error."))(
4364 tensor,
4365 str_array,
4366 str_array_len,
4367 str_n_len,
4368 )
4369 }
4370 }
4371
4372 #[doc = " Writes the string pointed to by the provided 'str' pointer of length 'len'\n into the provided 'tensor'. The string provided via 'str' is\n copied into the 'tensor'. Returns 'kTfLiteOk' in case of success. Any\n other return value indicates a failure.\n\n Note that calling 'TfLiteOpaqueTensorWriteString' deallocates any\n previously stored data in the 'tensor'. E.g. suppose 't' denotes a\n 'TfLiteOpaqueTensor*', then calling 'TfLiteOpaqueTensorWriteString(t, \"AB\",\n 2)' followed by a call to 'TfLiteOpaqueTensorWriteString(t, \"CD\", 2)' will\n lead to 't' containing 'CD', not 'ABCD'.\n\n 'TfLiteOpaqueTensorWriteString' is a convenience function for the use case\n of writing a single string to a tensor and its effects are identical to\n calling 'TfLiteOpaqueTensorWriteStrings' with an array of a single string."]
4373 pub unsafe fn TfLiteOpaqueTensorWriteString(
4374 &self,
4375 tensor: *mut TfLiteOpaqueTensor,
4376 str_: *const ::std::os::raw::c_char,
4377 len: ::std::os::raw::c_int,
4378 ) -> TfLiteStatus {
4379 unsafe {
4380 (self
4381 .TfLiteOpaqueTensorWriteString
4382 .as_ref()
4383 .expect("Expected function, got error."))(tensor, str_, len)
4384 }
4385 }
4386
4387 #[doc = " Creates an opaque tensor builder object."]
4388 pub unsafe fn TfLiteOpaqueTensorBuilderCreate(&self) -> *mut TfLiteOpaqueTensorBuilder {
4389 unsafe {
4390 (self
4391 .TfLiteOpaqueTensorBuilderCreate
4392 .as_ref()
4393 .expect("Expected function, got error."))()
4394 }
4395 }
4396
4397 #[doc = " Deletes an opaque tensor builder object."]
4398 pub unsafe fn TfLiteOpaqueTensorBuilderDelete(&self, builder: *mut TfLiteOpaqueTensorBuilder) {
4399 unsafe {
4400 (self
4401 .TfLiteOpaqueTensorBuilderDelete
4402 .as_ref()
4403 .expect("Expected function, got error."))(builder)
4404 }
4405 }
4406
4407 #[doc = " Sets the 'TfLiteType' of the provided 'builder' to the provided 'type'.\n Returns the address of the provided 'builder', so that builder calls can be\n chained together."]
4408 pub unsafe fn TfLiteOpaqueTensorBuilderSetType(
4409 &self,
4410 builder: *mut TfLiteOpaqueTensorBuilder,
4411 type_: TfLiteType,
4412 ) -> *mut TfLiteOpaqueTensorBuilder {
4413 unsafe {
4414 (self
4415 .TfLiteOpaqueTensorBuilderSetType
4416 .as_ref()
4417 .expect("Expected function, got error."))(builder, type_)
4418 }
4419 }
4420
4421 #[doc = " Sets the raw data of the provided 'builder' to the provided 'data'. Returns\n the address of the provided 'builder', so that builder calls can be chained\n together."]
4422 pub unsafe fn TfLiteOpaqueTensorBuilderSetData(
4423 &self,
4424 builder: *mut TfLiteOpaqueTensorBuilder,
4425 data: *mut ::std::os::raw::c_void,
4426 ) -> *mut TfLiteOpaqueTensorBuilder {
4427 unsafe {
4428 (self
4429 .TfLiteOpaqueTensorBuilderSetData
4430 .as_ref()
4431 .expect("Expected function, got error."))(builder, data)
4432 }
4433 }
4434
4435 #[doc = " Sets the allocation type of the provided 'builder' to the provided\n 'allocation_type'. The 'allocation_type' must be one of the following:\n 'kTfLiteDynamic', 'kTfLiteArenaRw' or 'kTfLiteArenaRwPersistent'. If the\n provided 'allocation_type' is not one of those values then\n 'TfLiteOpaqueContextAddTensor' will return an error. Returns the address of\n the provided 'builder', so that builder calls can be chained together."]
4436 pub unsafe fn TfLiteOpaqueTensorBuilderSetAllocationType(
4437 &self,
4438 builder: *mut TfLiteOpaqueTensorBuilder,
4439 allocation_type: TfLiteAllocationType,
4440 ) -> *mut TfLiteOpaqueTensorBuilder {
4441 unsafe {
4442 (self
4443 .TfLiteOpaqueTensorBuilderSetAllocationType
4444 .as_ref()
4445 .expect("Expected function, got error."))(builder, allocation_type)
4446 }
4447 }
4448
4449 #[doc = " Sets the quantization params of the provided 'builder' to the provided\n 'params'. Returns the address of the provided 'builder', so that builder\n calls can be chained together."]
4450 pub unsafe fn TfLiteOpaqueTensorBuilderSetQuantizationParams(
4451 &self,
4452 builder: *mut TfLiteOpaqueTensorBuilder,
4453 params: TfLiteQuantizationParams,
4454 ) -> *mut TfLiteOpaqueTensorBuilder {
4455 unsafe {
4456 (self
4457 .TfLiteOpaqueTensorBuilderSetQuantizationParams
4458 .as_ref()
4459 .expect("Expected function, got error."))(builder, params)
4460 }
4461 }
4462
4463 #[doc = " Sets the quantization of the provided 'builder' to the provided\n 'quantization'. Returns the address of the provided 'builder', so that\n builder calls can be chained together."]
4464 pub unsafe fn TfLiteOpaqueTensorBuilderSetQuantization(
4465 &self,
4466 builder: *mut TfLiteOpaqueTensorBuilder,
4467 quantization: TfLiteQuantization,
4468 ) -> *mut TfLiteOpaqueTensorBuilder {
4469 unsafe {
4470 (self
4471 .TfLiteOpaqueTensorBuilderSetQuantization
4472 .as_ref()
4473 .expect("Expected function, got error."))(builder, quantization)
4474 }
4475 }
4476
4477 #[doc = " Sets the allocation type of the provided 'tensor' to 'kTfLiteDynamic'.\n This function has no effect if the 'tensor's allocation type is already\n 'kTfLiteDynamic'. The provided 'tensor' must not be null."]
4478 pub unsafe fn TfLiteOpaqueTensorSetAllocationTypeToDynamic(
4479 &self,
4480 tensor: *mut TfLiteOpaqueTensor,
4481 ) {
4482 unsafe {
4483 (self
4484 .TfLiteOpaqueTensorSetAllocationTypeToDynamic
4485 .as_ref()
4486 .expect("Expected function, got error."))(tensor)
4487 }
4488 }
4489
4490 #[doc = " Returns the input tensor of the given node."]
4491 pub unsafe fn TfLiteOpaqueNodeGetInput(
4492 &self,
4493 opaque_context: *const TfLiteOpaqueContext,
4494 opaque_node: *const TfLiteOpaqueNode,
4495 index: ::std::os::raw::c_int,
4496 ) -> *const TfLiteOpaqueTensor {
4497 unsafe {
4498 (self
4499 .TfLiteOpaqueNodeGetInput
4500 .as_ref()
4501 .expect("Expected function, got error."))(
4502 opaque_context, opaque_node, index
4503 )
4504 }
4505 }
4506
4507 #[doc = " Returns the output tensor of the given node."]
4508 pub unsafe fn TfLiteOpaqueNodeGetOutput(
4509 &self,
4510 opaque_context: *mut TfLiteOpaqueContext,
4511 opaque_node: *const TfLiteOpaqueNode,
4512 index: ::std::os::raw::c_int,
4513 ) -> *mut TfLiteOpaqueTensor {
4514 unsafe {
4515 (self
4516 .TfLiteOpaqueNodeGetOutput
4517 .as_ref()
4518 .expect("Expected function, got error."))(
4519 opaque_context, opaque_node, index
4520 )
4521 }
4522 }
4523
4524 #[doc = " Gets the number of input tensors of the provided 'opaque_node'."]
4525 pub unsafe fn TfLiteOpaqueNodeNumberOfInputs(
4526 &self,
4527 opaque_node: *const TfLiteOpaqueNode,
4528 ) -> ::std::os::raw::c_int {
4529 unsafe {
4530 (self
4531 .TfLiteOpaqueNodeNumberOfInputs
4532 .as_ref()
4533 .expect("Expected function, got error."))(opaque_node)
4534 }
4535 }
4536
4537 #[doc = " Gets the number of output tensors of the provided 'opaque_node'."]
4538 pub unsafe fn TfLiteOpaqueNodeNumberOfOutputs(
4539 &self,
4540 opaque_node: *const TfLiteOpaqueNode,
4541 ) -> ::std::os::raw::c_int {
4542 unsafe {
4543 (self
4544 .TfLiteOpaqueNodeNumberOfOutputs
4545 .as_ref()
4546 .expect("Expected function, got error."))(opaque_node)
4547 }
4548 }
4549
4550 #[doc = " Returns opaque data provided by the node implementer. The value returned\n from this function is the value that was returned from the `init` callback\n that was passed to `TfLiteOperatorSetInit`."]
4551 pub unsafe fn TfLiteOpaqueNodeGetUserData(
4552 &self,
4553 opaque_node: *const TfLiteOpaqueNode,
4554 ) -> *mut ::std::os::raw::c_void {
4555 unsafe {
4556 (self
4557 .TfLiteOpaqueNodeGetUserData
4558 .as_ref()
4559 .expect("Expected function, got error."))(opaque_node)
4560 }
4561 }
4562
4563 #[doc = " Returns the builtin data associated with the provided 'opaque_node'.\n\n The builtin init data associated with a node would typically be set during\n the creation of the associated interpreter, through a mechanism like the\n interpreter builder that loads a TFLite model and initialises the\n interpreter's nodes accordingly. Under these conditions the returned\n address remains valid throughout the lifetime of the 'opaque_node'."]
4564 pub unsafe fn TfLiteOpaqueNodeGetBuiltinData(
4565 &self,
4566 opaque_node: *const TfLiteOpaqueNode,
4567 ) -> *mut ::std::os::raw::c_void {
4568 unsafe {
4569 (self
4570 .TfLiteOpaqueNodeGetBuiltinData
4571 .as_ref()
4572 .expect("Expected function, got error."))(opaque_node)
4573 }
4574 }
4575
4576 #[doc = " Loads into the provided '*init_data' pointer the address of the custom init\n data associated with the provided 'opaque_node'. The length of data is\n loaded into the provided 'size' pointer. Returns 'kTfLiteOk' in case\n of success. Any other return value indicates a failure and will leave\n 'init_data' and 'size' in an unspecified state.\n\n The custom init data associated with a node would typically be set during\n the creation of the associated interpreter, through a mechanism like the\n interpreter builder that loads a TFLite model and initialises the\n interpreter's nodes accordingly. Under these conditions the returned\n address remains valid throughout the lifetime of the 'opaque_node'."]
4577 pub unsafe fn TfLiteOpaqueNodeGetCustomInitialData(
4578 &self,
4579 opaque_node: *const TfLiteOpaqueNode,
4580 init_data: *mut *const ::std::os::raw::c_void,
4581 size: *mut ::std::os::raw::c_int,
4582 ) -> TfLiteStatus {
4583 unsafe {
4584 (self
4585 .TfLiteOpaqueNodeGetCustomInitialData
4586 .as_ref()
4587 .expect("Expected function, got error."))(opaque_node, init_data, size)
4588 }
4589 }
4590
4591 #[doc = " Loads into the provided '*inputs' pointer the starting address of an array\n of indices representing the tensors that are inputs of the provided\n 'opaque_node'. The length of the array is loaded into the provided\n 'num_inputs' pointer. Returns 'kTfLiteOk' in case of success. Any other\n return value indicates a failure and will leave 'inputs' and\n 'num_inputs' in an unspecified state.\n\n The input tensors associated with a node would typically be set during the\n creation of the associated interpreter, through a mechanism like the\n interpreter builder that loads a TFLite model and initialises the\n interpreter's nodes accordingly. Under these conditions the loaded address\n remains valid throughout the lifetime of the 'opaque_node'."]
4592 pub unsafe fn TfLiteOpaqueNodeInputs(
4593 &self,
4594 opaque_node: *const TfLiteOpaqueNode,
4595 inputs: *mut *const ::std::os::raw::c_int,
4596 num_inputs: *mut ::std::os::raw::c_int,
4597 ) -> TfLiteStatus {
4598 unsafe {
4599 (self
4600 .TfLiteOpaqueNodeInputs
4601 .as_ref()
4602 .expect("Expected function, got error."))(
4603 opaque_node, inputs, num_inputs
4604 )
4605 }
4606 }
4607
4608 #[doc = " Loads into the provided '*outputs' pointer the starting address of an array\n of indices representing the tensors that are outputs of the provided\n 'opaque_node'. The length of the array is loaded into the provided\n 'num_outputs' pointer. Returns 'kTfLiteOk' in case of success. Any other\n return value indicates a failure and will leave 'outputs' and\n 'num_outputs' in an unspecified state.\n\n The output tensors associated with a node would typically be set during the\n creation of the associated interpreter, through a mechanism like the\n interpreter builder that loads a TFLite model and initialises the\n interpreter's nodes accordingly. Under these conditions the loaded address\n remains valid throughout the lifetime of the 'opaque_node'."]
4609 pub unsafe fn TfLiteOpaqueNodeOutputs(
4610 &self,
4611 opaque_node: *const TfLiteOpaqueNode,
4612 outputs: *mut *const ::std::os::raw::c_int,
4613 num_outputs: *mut ::std::os::raw::c_int,
4614 ) -> TfLiteStatus {
4615 unsafe {
4616 (self
4617 .TfLiteOpaqueNodeOutputs
4618 .as_ref()
4619 .expect("Expected function, got error."))(
4620 opaque_node, outputs, num_outputs
4621 )
4622 }
4623 }
4624
4625 #[doc = " Set tensor indices of temporary tensors used during the computations.\n These temporary tensors should be allocated using AddTensors().\n By default nodes don't have any temporary tensors, tensors, but ops are\n allowed to change that if they need scratch space of any sort.\n This will make a copy of the contents of the array pointed to by\n `temporaries`."]
4626 pub unsafe fn TfLiteOpaqueNodeSetTemporaries(
4627 &self,
4628 opaque_node: *mut TfLiteOpaqueNode,
4629 temporaries: *const ::std::os::raw::c_int,
4630 num_temporaries: ::std::os::raw::c_int,
4631 ) -> TfLiteStatus {
4632 unsafe {
4633 (self
4634 .TfLiteOpaqueNodeSetTemporaries
4635 .as_ref()
4636 .expect("Expected function, got error."))(
4637 opaque_node, temporaries, num_temporaries
4638 )
4639 }
4640 }
4641
4642 #[doc = " Loads into the provided '*temporaries' pointer the starting address of an\n array of indices representing the temporary tensors associated with the\n provided 'opaque_node'. The length of the array is loaded into the provided\n 'num_temporaries' pointer. Returns 'kTfLiteOk' in case of success. Any\n other return value indicates a failure and will leave 'temporaries' and\n 'num_temporaries' in an unspecified state.\n\n The temporary tensors associated with a node would typically be set during\n the creation of the associated interpreter, through a mechanism like the\n interpreter builder that loads a TFLite model and initialises the\n interpreter's nodes accordingly. Under these conditions the loaded address\n remains valid throughout the lifetime of the 'opaque_node'."]
4643 pub unsafe fn TfLiteOpaqueNodeTemporaries(
4644 &self,
4645 opaque_node: *const TfLiteOpaqueNode,
4646 temporaries: *mut *const ::std::os::raw::c_int,
4647 num_temporaries: *mut ::std::os::raw::c_int,
4648 ) -> TfLiteStatus {
4649 unsafe {
4650 (self
4651 .TfLiteOpaqueNodeTemporaries
4652 .as_ref()
4653 .expect("Expected function, got error."))(
4654 opaque_node, temporaries, num_temporaries
4655 )
4656 }
4657 }
4658
4659 #[doc = " Given an 'index_of_input', which must be in the range of [0, N), where N is\n the number of input tensors of the provided 'opaque_node', returns the\n (global) index of the tensor that holds the input. Returns -1 if\n 'index_of_input' is not within the [0, N) range."]
4660 pub unsafe fn TfLiteOpaqueNodeGetInputTensorIndex(
4661 &self,
4662 opaque_node: *const TfLiteOpaqueNode,
4663 index_of_input: ::std::os::raw::c_int,
4664 ) -> ::std::os::raw::c_int {
4665 unsafe {
4666 (self
4667 .TfLiteOpaqueNodeGetInputTensorIndex
4668 .as_ref()
4669 .expect("Expected function, got error."))(opaque_node, index_of_input)
4670 }
4671 }
4672
4673 #[doc = " Given an 'index_of_output', which must be in the range of [0, N), where N is\n the number of output tensors of the provided 'opaque_node', returns the\n (global) index of the tensor that holds the output. Returns -1 if\n 'index_of_output' is not within the [0, N) range."]
4674 pub unsafe fn TfLiteOpaqueNodeGetOutputTensorIndex(
4675 &self,
4676 opaque_node: *const TfLiteOpaqueNode,
4677 index_of_output: ::std::os::raw::c_int,
4678 ) -> ::std::os::raw::c_int {
4679 unsafe {
4680 (self
4681 .TfLiteOpaqueNodeGetOutputTensorIndex
4682 .as_ref()
4683 .expect("Expected function, got error."))(opaque_node, index_of_output)
4684 }
4685 }
4686
4687 #[doc = " Loads the provided `execution_plan` associated with the provided\n `opaque_context`. Returns `kTfLiteOk` if the `execution_plan` was\n successfully loaded. A return value different from `kTfLiteOk` indicates a\n failure and the `execution_plan` will be left in an unspecified state."]
4688 pub unsafe fn TfLiteOpaqueContextGetExecutionPlan(
4689 &self,
4690 opaque_context: *mut TfLiteOpaqueContext,
4691 execution_plan: *mut *mut TfLiteIntArray,
4692 ) -> TfLiteStatus {
4693 unsafe {
4694 (self
4695 .TfLiteOpaqueContextGetExecutionPlan
4696 .as_ref()
4697 .expect("Expected function, got error."))(opaque_context, execution_plan)
4698 }
4699 }
4700
4701 #[doc = " Returns the external context of the specified type associated with the\n provided `opaque_context`. Returns `kTfLiteOk` if the external context was\n successfully loaded. A return value different from `kTfLiteOk` indicates a\n failure and the `external_context` will be left in an unspecified state."]
4702 pub unsafe fn TfLiteOpaqueContextGetExternalContext(
4703 &self,
4704 opaque_context: *mut TfLiteOpaqueContext,
4705 external_context: *mut *mut ::std::os::raw::c_void,
4706 type_: TfLiteExternalContextType,
4707 ) -> TfLiteStatus {
4708 unsafe {
4709 (self
4710 .TfLiteOpaqueContextGetExternalContext
4711 .as_ref()
4712 .expect("Expected function, got error."))(
4713 opaque_context, external_context, type_
4714 )
4715 }
4716 }
4717
4718 #[doc = " Given the specified 'opaque_context' and 'node_index', load the caller's\n opaque '*node' and '*registration_external' pointer. Return 'kTfLiteOk' if\n both the '*node' as well as the '*registration_external' have been loaded\n correctly. Any other return code indicates a failure and both '*node' as\n well as '*registration_external' will be in an unspecified state.\n\n A caller can obtain a node's index by calling\n 'TfLiteOpaqueContextGetExecutionPlan', which provides an array of node\n indices, sorted in execution order. A node index might also come from the\n data structures passed to the delegate kernel's callback parameters, like\n the delegate parameters data structure passed to the 'init' callback that\n contains an array of node indices that are meant to be handled by the\n delegate kernel.\n\n This function is expected to be called from within a delegate callback, like\n 'Prepare', or a delegate kernel callback (i.e., a callback registered with\n a 'TfLiteOperator' object).\n\n The loaded '*node' and '*registration_external' pointers will generally\n remain valid for the lifetime of the associated 'opaque_context', but can be\n invalidated through API calls where delegates get un-applied, like API calls\n that modify the model graph via a delegate, or if input tensors get\n re-sized.\n"]
4719 pub unsafe fn TfLiteOpaqueContextGetNodeAndRegistration(
4720 &self,
4721 opaque_context: *mut TfLiteOpaqueContext,
4722 node_index: ::std::os::raw::c_int,
4723 node: *mut *mut TfLiteOpaqueNode,
4724 registration_external: *mut *mut TfLiteOperator,
4725 ) -> TfLiteStatus {
4726 unsafe {
4727 (self
4728 .TfLiteOpaqueContextGetNodeAndRegistration
4729 .as_ref()
4730 .expect("Expected function, got error."))(
4731 opaque_context,
4732 node_index,
4733 node,
4734 registration_external,
4735 )
4736 }
4737 }
4738
4739 #[doc = " Entry point for C API ReplaceNodeSubsetsWithDelegateKernels\n\n Replaces the specified `nodes_to_replace` that are associated with the\n provided `opaque_context` with delegate kernels. The provided\n `registration_external` represents the delegate kernel and will be used for\n each node subset that will be delegate to the provided `opaque_delegate`.\n\n The TF Lite runtime will take ownership of the `registration_external` and\n will delete it when the associated `opaque_context` gets destroyed.\n\n The ownership of the `nodes_to_replace` and the `opaque_delegate` remains\n with the caller."]
4740 pub unsafe fn TfLiteOpaqueContextReplaceNodeSubsetsWithDelegateKernels(
4741 &self,
4742 opaque_context: *mut TfLiteOpaqueContext,
4743 registration_external: *mut TfLiteOperator,
4744 nodes_to_replace: *const TfLiteIntArray,
4745 opaque_delegate: *mut TfLiteOpaqueDelegate,
4746 ) -> TfLiteStatus {
4747 unsafe {
4748 (self
4749 .TfLiteOpaqueContextReplaceNodeSubsetsWithDelegateKernels
4750 .as_ref()
4751 .expect("Expected function, got error."))(
4752 opaque_context,
4753 registration_external,
4754 nodes_to_replace,
4755 opaque_delegate,
4756 )
4757 }
4758 }
4759
4760 #[doc = " Returns modifiable access to the opaque tensor that corresponds to the\n specified `index` and is associated with the provided `opaque_context`.\n\n This requires the `index` to be between 0 and N - 1, where N is the\n number of tensors in the model.\n\n Typically the tensors associated with the `context` would be set\n during the initialization of the `interpreter` that the `context` belongs\n to, through a mechanism like the `InterpreterBuilder`, and remain unchanged\n throughout the lifetime of the interpreter. However, there are some\n circumstances in which the pointer may not remain valid throughout the\n lifetime of the interpreter, because calls to `AddTensors` on the\n interpreter invalidate the returned pointer.\n\n The ownership of the tensor remains with the TFLite runtime, meaning the\n caller should not deallocate the pointer."]
4761 pub unsafe fn TfLiteOpaqueContextGetOpaqueTensor(
4762 &self,
4763 opaque_context: *const TfLiteOpaqueContext,
4764 index: ::std::os::raw::c_int,
4765 ) -> *mut TfLiteOpaqueTensor {
4766 unsafe {
4767 (self
4768 .TfLiteOpaqueContextGetOpaqueTensor
4769 .as_ref()
4770 .expect("Expected function, got error."))(opaque_context, index)
4771 }
4772 }
4773
4774 #[doc = " Loads into the provided '*inputs' pointer the starting address of an array\n of indices representing the tensors that are inputs to the subgraph that is\n associated with the provided 'opaque_context'. The length of the array is\n loaded into the provided 'num_inputs' pointer. Returns 'kTfLiteOk' in case\n of success. Any other return value indicates a failure and will leave\n 'inputs' and 'num_inputs' in an unspecified state. Calls to 'SetInputs' on\n the associated subgraph invalidate the loaded pointers."]
4775 pub unsafe fn TfLiteOpaqueContextGetInputs(
4776 &self,
4777 opaque_context: *const TfLiteOpaqueContext,
4778 inputs: *mut *const ::std::os::raw::c_int,
4779 num_inputs: *mut ::std::os::raw::c_int,
4780 ) -> TfLiteStatus {
4781 unsafe {
4782 (self
4783 .TfLiteOpaqueContextGetInputs
4784 .as_ref()
4785 .expect("Expected function, got error."))(
4786 opaque_context, inputs, num_inputs
4787 )
4788 }
4789 }
4790
4791 #[doc = " Loads into the provided '*outputs' pointer the starting address of an array\n of indices representing the tensors that are outputs to the subgraph that is\n associated with the provided 'opaque_context'. The length of the array is\n loaded into the provided 'num_outputs' pointer. Returns 'kTfLiteOk' in case\n of success. Any other return value indicates a failure and will leave\n 'outputs' and 'num_outputs' in an unspecified state. Calls to 'SetOutputs'\n on the associated subgraph invalidate the loaded pointers."]
4792 pub unsafe fn TfLiteOpaqueContextGetOutputs(
4793 &self,
4794 opaque_context: *const TfLiteOpaqueContext,
4795 outputs: *mut *const ::std::os::raw::c_int,
4796 num_outputs: *mut ::std::os::raw::c_int,
4797 ) -> TfLiteStatus {
4798 unsafe {
4799 (self
4800 .TfLiteOpaqueContextGetOutputs
4801 .as_ref()
4802 .expect("Expected function, got error."))(
4803 opaque_context, outputs, num_outputs
4804 )
4805 }
4806 }
4807
4808 #[doc = " Loads into the provided '*variables' pointer the starting address of an\n array of indices representing the tensors that are variables to the subgraph\n that is associated with the provided 'opaque_context'. The length of the\n array is loaded into the provided 'num_variables' pointer. Returns\n 'kTfLiteOk' in case of success. Any other return value indicates a failure\n and will leave 'variables' and 'num_variables' in an unspecified state.\n Calls to 'SetVariables' on the associated subgraph invalidate the loaded\n pointers."]
4809 pub unsafe fn TfLiteOpaqueContextGetVariables(
4810 &self,
4811 opaque_context: *const TfLiteOpaqueContext,
4812 variables: *mut *const ::std::os::raw::c_int,
4813 num_variables: *mut ::std::os::raw::c_int,
4814 ) -> TfLiteStatus {
4815 unsafe {
4816 (self
4817 .TfLiteOpaqueContextGetVariables
4818 .as_ref()
4819 .expect("Expected function, got error."))(
4820 opaque_context, variables, num_variables
4821 )
4822 }
4823 }
4824
4825 #[doc = " Returns the number of nodes associated with the provided 'opaque_context'."]
4826 pub unsafe fn TfLiteOpaqueContextGetNumNodes(
4827 &self,
4828 opaque_context: *const TfLiteOpaqueContext,
4829 ) -> usize {
4830 unsafe {
4831 (self
4832 .TfLiteOpaqueContextGetNumNodes
4833 .as_ref()
4834 .expect("Expected function, got error."))(opaque_context)
4835 }
4836 }
4837
4838 #[doc = " Returns the number of tensors associated with the provided 'opaque_context'."]
4839 pub unsafe fn TfLiteOpaqueContextGetNumTensors(
4840 &self,
4841 opaque_context: *const TfLiteOpaqueContext,
4842 ) -> usize {
4843 unsafe {
4844 (self
4845 .TfLiteOpaqueContextGetNumTensors
4846 .as_ref()
4847 .expect("Expected function, got error."))(opaque_context)
4848 }
4849 }
4850
4851 #[doc = " Returns the name of the subgraph that is associated with the provided\n 'opaque_context'. Typically the returned pointer will remain valid\n throughout the lifetime of the subgraph, but may be invalidated by a call to\n 'Subgraph::SetName'."]
4852 pub unsafe fn TfLiteOpaqueContextGetName(
4853 &self,
4854 opaque_context: *const TfLiteOpaqueContext,
4855 ) -> *const ::std::os::raw::c_char {
4856 unsafe {
4857 (self
4858 .TfLiteOpaqueContextGetName
4859 .as_ref()
4860 .expect("Expected function, got error."))(opaque_context)
4861 }
4862 }
4863
4864 #[doc = " Resizes the provided 'tensor' that is associated with the provided\n 'context' so that the 'tensor's shape matches the dimensionality specified\n via the provided 'new_size' array. Returns 'kTfLiteOk' in\n case of success. Any other return value indicates a failure and will leave\n the 'tensor' in an unspecified state. The TF Lite runtime takes ownership\n of the 'new_size' array, even in case of failure."]
4865 pub unsafe fn TfLiteOpaqueContextResizeTensor(
4866 &self,
4867 context: *mut TfLiteOpaqueContext,
4868 tensor: *mut TfLiteOpaqueTensor,
4869 new_size: *mut TfLiteIntArray,
4870 ) -> TfLiteStatus {
4871 unsafe {
4872 (self
4873 .TfLiteOpaqueContextResizeTensor
4874 .as_ref()
4875 .expect("Expected function, got error."))(context, tensor, new_size)
4876 }
4877 }
4878
4879 #[doc = " Entry point for C API AcquireSubgraphContext.\n\n Retrieves the corresponding TfLiteOpaqueContext of a subgraph given a\n subgraph index and switches to the delegate context for this subgraph. If an\n invalid subgraph index is given, then returns kTfLiteError.\n\n NOTE: This function is expected to be paired with\n TfLiteOpaqueContextReleaseSubgraphContext() once the delegate preparation is\n done and/or the delegate context functions are no longer needed."]
4880 pub unsafe fn TfLiteOpaqueContextAcquireSubgraphContext(
4881 &self,
4882 opaque_context: *mut TfLiteOpaqueContext,
4883 subgraph_index: ::std::os::raw::c_int,
4884 acquired_opaque_context: *mut *mut TfLiteOpaqueContext,
4885 ) -> TfLiteStatus {
4886 unsafe {
4887 (self
4888 .TfLiteOpaqueContextAcquireSubgraphContext
4889 .as_ref()
4890 .expect("Expected function, got error."))(
4891 opaque_context,
4892 subgraph_index,
4893 acquired_opaque_context,
4894 )
4895 }
4896 }
4897
4898 #[doc = " Entry point for C API ReleaseSubgraphContext.\n\n Releases the corresponding TfLiteOpaqueContext by switching back to the\n TFLite kernel context for this specified subgraph.\n\n NOTE: This function is expected to be used after\n TfLiteOpaqueContextAcquireSubgraphContext() once the delegate preparation is\n done and/or the delegate context functions are no longer needed."]
4899 pub unsafe fn TfLiteOpaqueContextReleaseSubgraphContext(
4900 &self,
4901 opaque_context: *mut TfLiteOpaqueContext,
4902 subgraph_index: ::std::os::raw::c_int,
4903 ) -> TfLiteStatus {
4904 unsafe {
4905 (self
4906 .TfLiteOpaqueContextReleaseSubgraphContext
4907 .as_ref()
4908 .expect("Expected function, got error."))(opaque_context, subgraph_index)
4909 }
4910 }
4911
4912 #[doc = " Entry point for C API MarkSubgraphAsDelegationSkippable\n\n Marks the subgraph with the given index as \"delegation-skippable\". Returns\n kTfLiteOk if the given subgraph index is valid and is successfully marked\n as delegation-skippable, and an error status if the subgraph index is\n invalid.\n If a subgraph is delegation-skippable, then the subgraph will be handled by\n a specific TfLiteOpaqueDelegate that is already supposed to be\n aware of this condition, and therefore, TfLiteInterpreter can skip invoking\n `ModifyGraphWithDelegate` on this subgraph.\n\n NOTE: This function is expected to be called only when the subgraph that\n `subgraph_index` is pointing to should be skipped by\n interpreter::ModifyGraphWithDelegate (e.g. the subgraph is part of the list\n of callee subgraphs of the same control flow node, and all of those callees\n are supported by the same delegate at once).\n\n For example, this function can be used when the delegate is handling\n control flow ops such as while ops. For instance, a while op has a condition\n subgraph indexed at `i` and a body subgraph indexed at `j`. The op can be\n delegated when the following conditions hold:\n 1. The delegate supports while op\n 2. Both condition subgraph `i` and body subgraph `j` can be fully\n delegated to the delegate.\n\n Then if the delegate decides to support the while node along with both body\n and condition subgraphs, it should mark subgraphs `i` and `j` skippable so\n that those two subgraphs won't be delegated to another delegate.\n\n WARNING: It is the delegate's responsibility to define when to skip\n `Subgraph::ModifyGraphWithDelegate`, to check for any edge cases (i.e.\n multiple references to the subgraph that `subgraph_index` is pointing to),\n and to mark a subgraph as skippable by using this function."]
4913 pub unsafe fn TfLiteOpaqueContextMarkSubgraphAsDelegationSkippable(
4914 &self,
4915 opaque_context: *mut TfLiteOpaqueContext,
4916 subgraph_index: ::std::os::raw::c_int,
4917 ) -> TfLiteStatus {
4918 unsafe {
4919 (self
4920 .TfLiteOpaqueContextMarkSubgraphAsDelegationSkippable
4921 .as_ref()
4922 .expect("Expected function, got error."))(opaque_context, subgraph_index)
4923 }
4924 }
4925
4926 #[doc = " Loads metadata of a TF Lite node's custom initialization data. Specifically:\n * Loads into the supplied 'fd' the file descriptor of the file that stores\n the 'node's custom initialization data. This output parameter will be\n loaded if the TF Lite runtime has access to the file descriptor, though\n this is not always the case, e.g. if a client provides a tflite::Model\n directly to the TF Lite runtime. If 'fd' can be loaded then 'kTfLiteOk'\n will be returned, otherwise 'kTfLiteError' is returned.\n * Loads into the supplied 'custom_initial_data_offset_in_file' pointer the\n offset of the 'node's custom init data in the file associated with 'fd'.\n This output parameter will be set to -1 if the 'node' does not have custom\n init data set.\n * Loads into the supplied 'custom_initial_data_size' the size of the\n custom initialization data. This output parameter will be set to -1 if\n the 'node' does not have custom init data set.\n\n Returns 'kTfLiteOk' when 'fd' has been loaded successfully and\n 'kTfLiteError' otherwise. Note that this means that 'kTfLiteOk' can be\n returned, even if the 'node' does not have custom init data set."]
4927 pub unsafe fn TfLiteOpaqueContextGetNodeInitDataMmapInfo(
4928 &self,
4929 context: *const TfLiteOpaqueContext,
4930 node: *const TfLiteOpaqueNode,
4931 fd: *mut ::std::os::raw::c_int,
4932 custom_initial_data_offset_in_file: *mut i64,
4933 custom_initial_data_size: *mut i64,
4934 ) -> TfLiteStatus {
4935 unsafe {
4936 (self
4937 .TfLiteOpaqueContextGetNodeInitDataMmapInfo
4938 .as_ref()
4939 .expect("Expected function, got error."))(
4940 context,
4941 node,
4942 fd,
4943 custom_initial_data_offset_in_file,
4944 custom_initial_data_size,
4945 )
4946 }
4947 }
4948
4949 #[doc = " Adds an additional tensor and configures its properties based on the\n provided 'builder', preserving pre-existing Tensor entries. If non-null,\n the value pointed to by 'new_tensor_index' will be set to the index of the\n new tensor. Returns 'kTfLiteOk' when the tensor has been added\n successfully. Returns 'kTfLiteError' in case of failure."]
4950 pub unsafe fn TfLiteOpaqueContextAddTensor(
4951 &self,
4952 context: *mut TfLiteOpaqueContext,
4953 builder: *mut TfLiteOpaqueTensorBuilder,
4954 new_tensor_index: *mut ::std::os::raw::c_int,
4955 ) -> TfLiteStatus {
4956 unsafe {
4957 (self
4958 .TfLiteOpaqueContextAddTensor
4959 .as_ref()
4960 .expect("Expected function, got error."))(
4961 context, builder, new_tensor_index
4962 )
4963 }
4964 }
4965
4966 #[doc = " Populates the size in bytes of a provide 'type' into 'bytes'. Returns\n 'kTfLiteOk' for valid types, and 'kTfLiteError' otherwise."]
4967 pub unsafe fn TfLiteOpaqueContextGetSizeOfType(
4968 &self,
4969 context: *mut TfLiteOpaqueContext,
4970 type_: TfLiteType,
4971 bytes: *mut usize,
4972 ) -> TfLiteStatus {
4973 unsafe {
4974 (self
4975 .TfLiteOpaqueContextGetSizeOfType
4976 .as_ref()
4977 .expect("Expected function, got error."))(context, type_, bytes)
4978 }
4979 }
4980
4981 #[doc = " Retrieves named metadata buffer from the TFLite model.\n Returns kTfLiteOk if metadata is successfully obtained from the flatbuffer\n model. That is, there exists a `metadata` entry with given `name` string.\n (see TFLite's schema.fbs).\n The corresponding `buffer` information is populated in `ptr` & `bytes`.\n The data from `ptr` is valid for the lifetime of the Interpreter."]
4982 pub unsafe fn TfLiteOpaqueContextGetMetadata(
4983 &self,
4984 context: *mut TfLiteOpaqueContext,
4985 name: *const ::std::os::raw::c_char,
4986 ptr: *mut *const ::std::os::raw::c_char,
4987 bytes: *mut usize,
4988 ) -> TfLiteStatus {
4989 unsafe {
4990 (self
4991 .TfLiteOpaqueContextGetMetadata
4992 .as_ref()
4993 .expect("Expected function, got error."))(context, name, ptr, bytes)
4994 }
4995 }
4996
4997 #[doc = " Same as `TfLiteOpaqueContextReportError`, but with the variable arguments\n passed via a `va_list` instead of directly.\n\n Callers that receive an ellipsis and want to forward it to\n to the opaque context error reporting API can add the ellipsis content to a\n `va_list` and then call `TfLiteOpaqueContextReportErrorVa`. E.g.:\n\n```text\n void MyErrorReporter(struct TfLiteOpaqueContext* opaque_context,\n const char* format, ...) {\n va_list vlist;\n va_start(vlist, format);\n TfLiteOpaqueContextReportErrorVa(opaque_context, format, vlist);\n va_end(vlist);\n }\n```"]
4998 pub unsafe fn TfLiteOpaqueContextReportErrorVa(
4999 &self,
5000 opaque_context: *mut TfLiteOpaqueContext,
5001 format: *const ::std::os::raw::c_char,
5002 vlist: *mut __va_list_tag,
5003 ) {
5004 unsafe {
5005 (self
5006 .TfLiteOpaqueContextReportErrorVa
5007 .as_ref()
5008 .expect("Expected function, got error."))(opaque_context, format, vlist)
5009 }
5010 }
5011}