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