1use core::ffi::{c_char, c_void};
2
3unsafe extern "C" {
4 pub fn mpsgraph_object_retain(handle: *mut c_void) -> *mut c_void;
5 pub fn mpsgraph_operation_as_variable(handle: *mut c_void) -> *mut c_void;
6 pub fn mpsgraph_variable_op_shape_len(handle: *mut c_void) -> usize;
7 pub fn mpsgraph_variable_op_copy_shape(handle: *mut c_void, out_shape: *mut isize);
8 pub fn mpsgraph_variable_op_data_type(handle: *mut c_void) -> u32;
9
10 pub fn mpsgraph_convolution3d_descriptor_new(
11 stride_in_x: usize,
12 stride_in_y: usize,
13 stride_in_z: usize,
14 dilation_rate_in_x: usize,
15 dilation_rate_in_y: usize,
16 dilation_rate_in_z: usize,
17 groups: usize,
18 padding_left: usize,
19 padding_right: usize,
20 padding_top: usize,
21 padding_bottom: usize,
22 padding_front: usize,
23 padding_back: usize,
24 padding_style: usize,
25 data_layout: usize,
26 weights_layout: usize,
27 ) -> *mut c_void;
28 pub fn mpsgraph_depthwise_convolution2d_descriptor_new(
29 stride_in_x: usize,
30 stride_in_y: usize,
31 dilation_rate_in_x: usize,
32 dilation_rate_in_y: usize,
33 padding_left: usize,
34 padding_right: usize,
35 padding_top: usize,
36 padding_bottom: usize,
37 padding_style: usize,
38 data_layout: usize,
39 weights_layout: usize,
40 ) -> *mut c_void;
41 pub fn mpsgraph_depthwise_convolution3d_descriptor_new(
42 strides: *const usize,
43 strides_len: usize,
44 dilation_rates: *const usize,
45 dilation_rates_len: usize,
46 padding_values: *const usize,
47 padding_values_len: usize,
48 padding_style: usize,
49 channel_dimension_index: isize,
50 ) -> *mut c_void;
51 pub fn mpsgraph_fft_descriptor_new(
52 inverse: bool,
53 scaling_mode: usize,
54 round_to_odd_hermitean: bool,
55 ) -> *mut c_void;
56 pub fn mpsgraph_im_to_col_descriptor_new(
57 kernel_width: usize,
58 kernel_height: usize,
59 stride_in_x: usize,
60 stride_in_y: usize,
61 dilation_rate_in_x: usize,
62 dilation_rate_in_y: usize,
63 padding_left: usize,
64 padding_right: usize,
65 padding_top: usize,
66 padding_bottom: usize,
67 data_layout: usize,
68 ) -> *mut c_void;
69 pub fn mpsgraph_pooling4d_descriptor_new(
70 kernel_sizes: *const usize,
71 kernel_sizes_len: usize,
72 strides: *const usize,
73 strides_len: usize,
74 dilation_rates: *const usize,
75 dilation_rates_len: usize,
76 padding_values: *const usize,
77 padding_values_len: usize,
78 padding_style: usize,
79 ceil_mode: bool,
80 include_zero_pad_to_average: bool,
81 return_indices_mode: usize,
82 return_indices_data_type: u32,
83 ) -> *mut c_void;
84 pub fn mpsgraph_sparse_descriptor_new(storage_type: u64, data_type: u32) -> *mut c_void;
85 pub fn mpsgraph_stencil_descriptor_new(
86 reduction_mode: usize,
87 offsets: *const isize,
88 offsets_len: usize,
89 strides: *const usize,
90 strides_len: usize,
91 dilation_rates: *const usize,
92 dilation_rates_len: usize,
93 explicit_padding: *const usize,
94 explicit_padding_len: usize,
95 boundary_mode: isize,
96 padding_style: usize,
97 padding_constant: f32,
98 ) -> *mut c_void;
99
100 pub fn mpsgraph_graph_convolution3d(
101 graph_handle: *mut c_void,
102 source_tensor: *mut c_void,
103 weights_tensor: *mut c_void,
104 descriptor_handle: *mut c_void,
105 name: *const c_char,
106 ) -> *mut c_void;
107 pub fn mpsgraph_graph_convolution_transpose2d(
108 graph_handle: *mut c_void,
109 source_tensor: *mut c_void,
110 weights_tensor: *mut c_void,
111 output_shape: *const usize,
112 output_shape_len: usize,
113 descriptor_handle: *mut c_void,
114 name: *const c_char,
115 ) -> *mut c_void;
116 pub fn mpsgraph_graph_cumulative_sum(
117 graph_handle: *mut c_void,
118 tensor: *mut c_void,
119 axis: isize,
120 exclusive: bool,
121 reverse: bool,
122 name: *const c_char,
123 ) -> *mut c_void;
124 pub fn mpsgraph_graph_depthwise_convolution2d(
125 graph_handle: *mut c_void,
126 source_tensor: *mut c_void,
127 weights_tensor: *mut c_void,
128 descriptor_handle: *mut c_void,
129 name: *const c_char,
130 ) -> *mut c_void;
131 pub fn mpsgraph_graph_depthwise_convolution3d(
132 graph_handle: *mut c_void,
133 source_tensor: *mut c_void,
134 weights_tensor: *mut c_void,
135 descriptor_handle: *mut c_void,
136 name: *const c_char,
137 ) -> *mut c_void;
138 pub fn mpsgraph_graph_fast_fourier_transform(
139 graph_handle: *mut c_void,
140 tensor: *mut c_void,
141 axes: *const usize,
142 axes_len: usize,
143 descriptor_handle: *mut c_void,
144 name: *const c_char,
145 ) -> *mut c_void;
146 pub fn mpsgraph_graph_im_to_col(
147 graph_handle: *mut c_void,
148 source_tensor: *mut c_void,
149 descriptor_handle: *mut c_void,
150 name: *const c_char,
151 ) -> *mut c_void;
152 pub fn mpsgraph_graph_band_part(
153 graph_handle: *mut c_void,
154 tensor: *mut c_void,
155 num_lower: isize,
156 num_upper: isize,
157 name: *const c_char,
158 ) -> *mut c_void;
159 pub fn mpsgraph_graph_softmax_cross_entropy(
160 graph_handle: *mut c_void,
161 source_tensor: *mut c_void,
162 labels_tensor: *mut c_void,
163 axis: isize,
164 reduction_type: u64,
165 name: *const c_char,
166 ) -> *mut c_void;
167 pub fn mpsgraph_graph_matrix_inverse(
168 graph_handle: *mut c_void,
169 tensor: *mut c_void,
170 name: *const c_char,
171 ) -> *mut c_void;
172 pub fn mpsgraph_graph_variable_data(
173 graph_handle: *mut c_void,
174 bytes: *const c_void,
175 byte_len: usize,
176 shape: *const usize,
177 shape_len: usize,
178 data_type: u32,
179 name: *const c_char,
180 ) -> *mut c_void;
181 pub fn mpsgraph_graph_read_variable(
182 graph_handle: *mut c_void,
183 variable_tensor: *mut c_void,
184 name: *const c_char,
185 ) -> *mut c_void;
186 pub fn mpsgraph_graph_assign_variable(
187 graph_handle: *mut c_void,
188 variable_tensor: *mut c_void,
189 value_tensor: *mut c_void,
190 name: *const c_char,
191 ) -> *mut c_void;
192 pub fn mpsgraph_graph_non_maximum_suppression(
193 graph_handle: *mut c_void,
194 boxes_tensor: *mut c_void,
195 scores_tensor: *mut c_void,
196 iou_threshold: f32,
197 score_threshold: f32,
198 per_class_suppression: bool,
199 coordinate_mode: usize,
200 name: *const c_char,
201 ) -> *mut c_void;
202 pub fn mpsgraph_graph_non_zero_indices(
203 graph_handle: *mut c_void,
204 tensor: *mut c_void,
205 name: *const c_char,
206 ) -> *mut c_void;
207 pub fn mpsgraph_graph_one_hot(
208 graph_handle: *mut c_void,
209 indices_tensor: *mut c_void,
210 depth: usize,
211 data_type: u32,
212 name: *const c_char,
213 ) -> *mut c_void;
214 pub fn mpsgraph_graph_stochastic_gradient_descent(
215 graph_handle: *mut c_void,
216 learning_rate_tensor: *mut c_void,
217 values_tensor: *mut c_void,
218 gradient_tensor: *mut c_void,
219 name: *const c_char,
220 ) -> *mut c_void;
221 pub fn mpsgraph_graph_max_pooling4d(
222 graph_handle: *mut c_void,
223 source_tensor: *mut c_void,
224 descriptor_handle: *mut c_void,
225 name: *const c_char,
226 ) -> *mut c_void;
227 pub fn mpsgraph_graph_max_pooling4d_return_indices(
228 graph_handle: *mut c_void,
229 source_tensor: *mut c_void,
230 descriptor_handle: *mut c_void,
231 name: *const c_char,
232 ) -> *mut c_void;
233 pub fn mpsgraph_graph_quantize(
234 graph_handle: *mut c_void,
235 tensor: *mut c_void,
236 scale: f64,
237 zero_point: f64,
238 data_type: u32,
239 name: *const c_char,
240 ) -> *mut c_void;
241 pub fn mpsgraph_graph_dequantize(
242 graph_handle: *mut c_void,
243 tensor: *mut c_void,
244 scale: f64,
245 zero_point: f64,
246 data_type: u32,
247 name: *const c_char,
248 ) -> *mut c_void;
249 pub fn mpsgraph_graph_resize(
250 graph_handle: *mut c_void,
251 images_tensor: *mut c_void,
252 size: *const usize,
253 size_len: usize,
254 mode: usize,
255 center_result: bool,
256 align_corners: bool,
257 layout: usize,
258 name: *const c_char,
259 ) -> *mut c_void;
260 pub fn mpsgraph_graph_resize_nearest(
261 graph_handle: *mut c_void,
262 images_tensor: *mut c_void,
263 size_tensor: *mut c_void,
264 nearest_rounding_mode: usize,
265 center_result: bool,
266 align_corners: bool,
267 layout: usize,
268 name: *const c_char,
269 ) -> *mut c_void;
270 pub fn mpsgraph_graph_sample_grid(
271 graph_handle: *mut c_void,
272 source_tensor: *mut c_void,
273 coordinate_tensor: *mut c_void,
274 layout: usize,
275 normalize_coordinates: bool,
276 relative_coordinates: bool,
277 align_corners: bool,
278 padding_mode: isize,
279 sampling_mode: usize,
280 constant_value: f64,
281 name: *const c_char,
282 ) -> *mut c_void;
283 pub fn mpsgraph_graph_scatter_nd(
284 graph_handle: *mut c_void,
285 updates_tensor: *mut c_void,
286 indices_tensor: *mut c_void,
287 shape: *const usize,
288 shape_len: usize,
289 batch_dimensions: usize,
290 mode: isize,
291 name: *const c_char,
292 ) -> *mut c_void;
293 pub fn mpsgraph_graph_scatter(
294 graph_handle: *mut c_void,
295 updates_tensor: *mut c_void,
296 indices_tensor: *mut c_void,
297 shape: *const usize,
298 shape_len: usize,
299 axis: isize,
300 mode: isize,
301 name: *const c_char,
302 ) -> *mut c_void;
303 pub fn mpsgraph_graph_scatter_along_axis(
304 graph_handle: *mut c_void,
305 axis: isize,
306 updates_tensor: *mut c_void,
307 indices_tensor: *mut c_void,
308 shape: *const usize,
309 shape_len: usize,
310 mode: isize,
311 name: *const c_char,
312 ) -> *mut c_void;
313 pub fn mpsgraph_graph_sort(
314 graph_handle: *mut c_void,
315 tensor: *mut c_void,
316 axis: isize,
317 descending: bool,
318 name: *const c_char,
319 ) -> *mut c_void;
320 pub fn mpsgraph_graph_arg_sort(
321 graph_handle: *mut c_void,
322 tensor: *mut c_void,
323 axis: isize,
324 descending: bool,
325 name: *const c_char,
326 ) -> *mut c_void;
327 pub fn mpsgraph_graph_sparse_tensor_with_descriptor(
328 graph_handle: *mut c_void,
329 descriptor_handle: *mut c_void,
330 tensor_handles: *const *mut c_void,
331 tensor_count: usize,
332 shape: *const usize,
333 shape_len: usize,
334 name: *const c_char,
335 ) -> *mut c_void;
336 pub fn mpsgraph_graph_stencil(
337 graph_handle: *mut c_void,
338 source_tensor: *mut c_void,
339 weights_tensor: *mut c_void,
340 descriptor_handle: *mut c_void,
341 name: *const c_char,
342 ) -> *mut c_void;
343 pub fn mpsgraph_graph_topk_gradient(
344 graph_handle: *mut c_void,
345 gradient_tensor: *mut c_void,
346 source_tensor: *mut c_void,
347 k: usize,
348 name: *const c_char,
349 ) -> *mut c_void;
350
351 pub fn mpsgraph_execution_descriptor_wait_for_event(
352 handle: *mut c_void,
353 event_handle: *mut c_void,
354 value: u64,
355 ) -> bool;
356 pub fn mpsgraph_execution_descriptor_signal_event(
357 handle: *mut c_void,
358 event_handle: *mut c_void,
359 execution_stage: u64,
360 value: u64,
361 ) -> bool;
362 pub fn mpsgraph_executable_execution_descriptor_wait_for_event(
363 handle: *mut c_void,
364 event_handle: *mut c_void,
365 value: u64,
366 ) -> bool;
367 pub fn mpsgraph_executable_execution_descriptor_signal_event(
368 handle: *mut c_void,
369 event_handle: *mut c_void,
370 execution_stage: u64,
371 value: u64,
372 ) -> bool;
373}