1use core::ffi::{c_char, c_void};
2
3pub type TensorArrayCallback = unsafe extern "C" fn(context: *mut c_void) -> *mut c_void;
4pub type TensorArrayInputCallback =
5 unsafe extern "C" fn(context: *mut c_void, input_box_handle: *mut c_void) -> *mut c_void;
6pub type WhileBeforeCallback = unsafe extern "C" fn(
7 context: *mut c_void,
8 input_box_handle: *mut c_void,
9 out_result_box_handle: *mut *mut c_void,
10) -> *mut c_void;
11pub type ForBodyCallback = unsafe extern "C" fn(
12 context: *mut c_void,
13 index_handle: *mut c_void,
14 input_box_handle: *mut c_void,
15) -> *mut c_void;
16
17mod specialized;
18pub use specialized::*;
19
20unsafe extern "C" {
21 pub fn mpsgraph_object_release(handle: *mut c_void);
22
23 pub fn mpsgraph_tensor_data_new_with_bytes(
24 device_handle: *mut c_void,
25 bytes: *const c_void,
26 byte_len: usize,
27 shape: *const usize,
28 shape_len: usize,
29 data_type: u32,
30 ) -> *mut c_void;
31 pub fn mpsgraph_tensor_data_new_with_buffer(
32 buffer_handle: *mut c_void,
33 shape: *const usize,
34 shape_len: usize,
35 data_type: u32,
36 ) -> *mut c_void;
37 pub fn mpsgraph_tensor_data_data_type(handle: *mut c_void) -> u32;
38 pub fn mpsgraph_tensor_data_shape_len(handle: *mut c_void) -> usize;
39 pub fn mpsgraph_tensor_data_copy_shape(handle: *mut c_void, out_shape: *mut usize);
40 pub fn mpsgraph_tensor_data_read_bytes(
41 handle: *mut c_void,
42 dst: *mut c_void,
43 dst_len: usize,
44 ) -> bool;
45 pub fn mpsgraph_tensor_data_device(handle: *mut c_void) -> *mut c_void;
46
47 pub fn mpsgraph_graph_new() -> *mut c_void;
48 pub fn mpsgraph_graph_placeholder(
49 graph_handle: *mut c_void,
50 shape: *const usize,
51 shape_len: usize,
52 data_type: u32,
53 name: *const c_char,
54 ) -> *mut c_void;
55 pub fn mpsgraph_graph_constant_data(
56 graph_handle: *mut c_void,
57 bytes: *const c_void,
58 byte_len: usize,
59 shape: *const usize,
60 shape_len: usize,
61 data_type: u32,
62 ) -> *mut c_void;
63 pub fn mpsgraph_graph_constant_scalar(
64 graph_handle: *mut c_void,
65 scalar: f64,
66 data_type: u32,
67 ) -> *mut c_void;
68 pub fn mpsgraph_graph_constant_scalar_shaped(
69 graph_handle: *mut c_void,
70 scalar: f64,
71 shape: *const usize,
72 shape_len: usize,
73 data_type: u32,
74 ) -> *mut c_void;
75
76 pub fn mpsgraph_graph_addition(
77 graph_handle: *mut c_void,
78 primary_tensor: *mut c_void,
79 secondary_tensor: *mut c_void,
80 name: *const c_char,
81 ) -> *mut c_void;
82 pub fn mpsgraph_graph_subtraction(
83 graph_handle: *mut c_void,
84 primary_tensor: *mut c_void,
85 secondary_tensor: *mut c_void,
86 name: *const c_char,
87 ) -> *mut c_void;
88 pub fn mpsgraph_graph_multiplication(
89 graph_handle: *mut c_void,
90 primary_tensor: *mut c_void,
91 secondary_tensor: *mut c_void,
92 name: *const c_char,
93 ) -> *mut c_void;
94 pub fn mpsgraph_graph_division(
95 graph_handle: *mut c_void,
96 primary_tensor: *mut c_void,
97 secondary_tensor: *mut c_void,
98 name: *const c_char,
99 ) -> *mut c_void;
100 pub fn mpsgraph_graph_matrix_multiplication(
101 graph_handle: *mut c_void,
102 primary_tensor: *mut c_void,
103 secondary_tensor: *mut c_void,
104 name: *const c_char,
105 ) -> *mut c_void;
106 pub fn mpsgraph_graph_relu(
107 graph_handle: *mut c_void,
108 tensor: *mut c_void,
109 name: *const c_char,
110 ) -> *mut c_void;
111 pub fn mpsgraph_graph_sigmoid(
112 graph_handle: *mut c_void,
113 tensor: *mut c_void,
114 name: *const c_char,
115 ) -> *mut c_void;
116 pub fn mpsgraph_graph_softmax(
117 graph_handle: *mut c_void,
118 tensor: *mut c_void,
119 axis: isize,
120 name: *const c_char,
121 ) -> *mut c_void;
122 pub fn mpsgraph_graph_reshape(
123 graph_handle: *mut c_void,
124 tensor: *mut c_void,
125 shape: *const usize,
126 shape_len: usize,
127 name: *const c_char,
128 ) -> *mut c_void;
129 pub fn mpsgraph_graph_transpose(
130 graph_handle: *mut c_void,
131 tensor: *mut c_void,
132 permutation: *const usize,
133 permutation_len: usize,
134 name: *const c_char,
135 ) -> *mut c_void;
136 pub fn mpsgraph_graph_slice(
137 graph_handle: *mut c_void,
138 tensor: *mut c_void,
139 dimension: usize,
140 start: isize,
141 length: isize,
142 name: *const c_char,
143 ) -> *mut c_void;
144 pub fn mpsgraph_graph_broadcast(
145 graph_handle: *mut c_void,
146 tensor: *mut c_void,
147 shape: *const usize,
148 shape_len: usize,
149 name: *const c_char,
150 ) -> *mut c_void;
151 pub fn mpsgraph_graph_reduction_sum(
152 graph_handle: *mut c_void,
153 tensor: *mut c_void,
154 axes: *const usize,
155 axes_len: usize,
156 name: *const c_char,
157 ) -> *mut c_void;
158 pub fn mpsgraph_graph_reduction_maximum(
159 graph_handle: *mut c_void,
160 tensor: *mut c_void,
161 axes: *const usize,
162 axes_len: usize,
163 name: *const c_char,
164 ) -> *mut c_void;
165 pub fn mpsgraph_graph_reduction_minimum(
166 graph_handle: *mut c_void,
167 tensor: *mut c_void,
168 axes: *const usize,
169 axes_len: usize,
170 name: *const c_char,
171 ) -> *mut c_void;
172 pub fn mpsgraph_graph_mean(
173 graph_handle: *mut c_void,
174 tensor: *mut c_void,
175 axes: *const usize,
176 axes_len: usize,
177 name: *const c_char,
178 ) -> *mut c_void;
179
180 pub fn mpsgraph_convolution2d_descriptor_new(
181 stride_in_x: usize,
182 stride_in_y: usize,
183 dilation_rate_in_x: usize,
184 dilation_rate_in_y: usize,
185 groups: usize,
186 padding_left: usize,
187 padding_right: usize,
188 padding_top: usize,
189 padding_bottom: usize,
190 padding_style: usize,
191 data_layout: usize,
192 weights_layout: usize,
193 ) -> *mut c_void;
194 pub fn mpsgraph_pooling2d_descriptor_new(
195 kernel_width: usize,
196 kernel_height: usize,
197 stride_in_x: usize,
198 stride_in_y: usize,
199 dilation_rate_in_x: usize,
200 dilation_rate_in_y: usize,
201 padding_left: usize,
202 padding_right: usize,
203 padding_top: usize,
204 padding_bottom: usize,
205 padding_style: usize,
206 data_layout: usize,
207 ) -> *mut c_void;
208 pub fn mpsgraph_graph_convolution2d(
209 graph_handle: *mut c_void,
210 source_tensor: *mut c_void,
211 weights_tensor: *mut c_void,
212 descriptor_handle: *mut c_void,
213 name: *const c_char,
214 ) -> *mut c_void;
215 pub fn mpsgraph_graph_max_pooling2d(
216 graph_handle: *mut c_void,
217 source_tensor: *mut c_void,
218 descriptor_handle: *mut c_void,
219 name: *const c_char,
220 ) -> *mut c_void;
221 pub fn mpsgraph_graph_normalize(
222 graph_handle: *mut c_void,
223 tensor: *mut c_void,
224 mean_tensor: *mut c_void,
225 variance_tensor: *mut c_void,
226 gamma_tensor: *mut c_void,
227 beta_tensor: *mut c_void,
228 epsilon: f32,
229 name: *const c_char,
230 ) -> *mut c_void;
231
232 pub fn mpsgraph_graph_run(
233 graph_handle: *mut c_void,
234 feed_tensors: *const *mut c_void,
235 feed_data: *const *mut c_void,
236 feed_count: usize,
237 target_tensors: *const *mut c_void,
238 target_count: usize,
239 out_results: *mut *mut c_void,
240 ) -> bool;
241 pub fn mpsgraph_graph_run_with_command_queue(
242 graph_handle: *mut c_void,
243 command_queue_handle: *mut c_void,
244 feed_tensors: *const *mut c_void,
245 feed_data: *const *mut c_void,
246 feed_count: usize,
247 target_tensors: *const *mut c_void,
248 target_count: usize,
249 out_results: *mut *mut c_void,
250 ) -> bool;
251 pub fn mpsgraph_graph_compile(
252 graph_handle: *mut c_void,
253 device_handle: *mut c_void,
254 feed_tensors: *const *mut c_void,
255 feed_count: usize,
256 flat_shapes: *const usize,
257 shape_lengths: *const usize,
258 data_types: *const u32,
259 target_tensors: *const *mut c_void,
260 target_count: usize,
261 ) -> *mut c_void;
262 pub fn mpsgraph_executable_run(
263 executable_handle: *mut c_void,
264 command_queue_handle: *mut c_void,
265 input_data: *const *mut c_void,
266 input_count: usize,
267 output_count: usize,
268 out_results: *mut *mut c_void,
269 ) -> bool;
270
271 pub fn mpsgraph_tensor_array_box_len(handle: *mut c_void) -> usize;
272 pub fn mpsgraph_tensor_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
273 pub fn mpsgraph_tensor_data_array_box_len(handle: *mut c_void) -> usize;
274 pub fn mpsgraph_tensor_data_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
275 pub fn mpsgraph_shaped_type_array_box_len(handle: *mut c_void) -> usize;
276 pub fn mpsgraph_shaped_type_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
277
278 pub fn mpsgraph_device_new_with_metal_device(metal_device_handle: *mut c_void) -> *mut c_void;
279 pub fn mpsgraph_device_type(handle: *mut c_void) -> u32;
280
281 pub fn mpsgraph_shaped_type_new(
282 shape: *const isize,
283 shape_len: usize,
284 data_type: u32,
285 ) -> *mut c_void;
286 pub fn mpsgraph_shaped_type_has_shape(handle: *mut c_void) -> bool;
287 pub fn mpsgraph_shaped_type_shape_len(handle: *mut c_void) -> usize;
288 pub fn mpsgraph_shaped_type_copy_shape(handle: *mut c_void, out_shape: *mut isize);
289 pub fn mpsgraph_shaped_type_data_type(handle: *mut c_void) -> u32;
290 pub fn mpsgraph_shaped_type_set_shape(
291 handle: *mut c_void,
292 shape: *const isize,
293 shape_len: usize,
294 ) -> bool;
295 pub fn mpsgraph_shaped_type_set_data_type(handle: *mut c_void, data_type: u32) -> bool;
296 pub fn mpsgraph_shaped_type_is_equal(handle: *mut c_void, other_handle: *mut c_void) -> bool;
297
298 pub fn mpsgraph_tensor_has_shape(handle: *mut c_void) -> bool;
299 pub fn mpsgraph_tensor_shape_len(handle: *mut c_void) -> usize;
300 pub fn mpsgraph_tensor_copy_shape(handle: *mut c_void, out_shape: *mut isize);
301 pub fn mpsgraph_tensor_data_type(handle: *mut c_void) -> u32;
302 pub fn mpsgraph_tensor_operation(handle: *mut c_void) -> *mut c_void;
303
304 pub fn mpsgraph_graph_options(handle: *mut c_void) -> u64;
305 pub fn mpsgraph_graph_set_options(handle: *mut c_void, raw_value: u64) -> bool;
306 pub fn mpsgraph_graph_placeholder_tensors(handle: *mut c_void) -> *mut c_void;
307
308 pub fn mpsgraph_compilation_descriptor_new() -> *mut c_void;
309 pub fn mpsgraph_compilation_descriptor_disable_type_inference(handle: *mut c_void) -> bool;
310 pub fn mpsgraph_compilation_descriptor_optimization_level(handle: *mut c_void) -> u64;
311 pub fn mpsgraph_compilation_descriptor_set_optimization_level(
312 handle: *mut c_void,
313 raw_value: u64,
314 ) -> bool;
315 pub fn mpsgraph_compilation_descriptor_wait_for_completion(handle: *mut c_void) -> bool;
316 pub fn mpsgraph_compilation_descriptor_set_wait_for_completion(
317 handle: *mut c_void,
318 value: bool,
319 ) -> bool;
320 pub fn mpsgraph_compilation_descriptor_optimization_profile(handle: *mut c_void) -> u64;
321 pub fn mpsgraph_compilation_descriptor_set_optimization_profile(
322 handle: *mut c_void,
323 raw_value: u64,
324 ) -> bool;
325 pub fn mpsgraph_compilation_descriptor_reduced_precision_fast_math(
326 handle: *mut c_void,
327 ) -> usize;
328 pub fn mpsgraph_compilation_descriptor_set_reduced_precision_fast_math(
329 handle: *mut c_void,
330 raw_value: usize,
331 ) -> bool;
332
333 pub fn mpsgraph_execution_descriptor_new() -> *mut c_void;
334 pub fn mpsgraph_execution_descriptor_wait_until_completed(handle: *mut c_void) -> bool;
335 pub fn mpsgraph_execution_descriptor_set_wait_until_completed(
336 handle: *mut c_void,
337 value: bool,
338 ) -> bool;
339 pub fn mpsgraph_execution_descriptor_compilation_descriptor(handle: *mut c_void)
340 -> *mut c_void;
341 pub fn mpsgraph_execution_descriptor_set_compilation_descriptor(
342 handle: *mut c_void,
343 compilation_descriptor_handle: *mut c_void,
344 ) -> bool;
345
346 pub fn mpsgraph_executable_execution_descriptor_new() -> *mut c_void;
347 pub fn mpsgraph_executable_execution_descriptor_wait_until_completed(
348 handle: *mut c_void,
349 ) -> bool;
350 pub fn mpsgraph_executable_execution_descriptor_set_wait_until_completed(
351 handle: *mut c_void,
352 value: bool,
353 ) -> bool;
354
355 pub fn mpsgraph_executable_serialization_descriptor_new() -> *mut c_void;
356 pub fn mpsgraph_executable_serialization_descriptor_append(handle: *mut c_void) -> bool;
357 pub fn mpsgraph_executable_serialization_descriptor_set_append(
358 handle: *mut c_void,
359 value: bool,
360 ) -> bool;
361 pub fn mpsgraph_executable_serialization_descriptor_deployment_platform(
362 handle: *mut c_void,
363 ) -> u64;
364 pub fn mpsgraph_executable_serialization_descriptor_set_deployment_platform(
365 handle: *mut c_void,
366 raw_value: u64,
367 ) -> bool;
368 pub fn mpsgraph_executable_serialization_descriptor_minimum_deployment_target_len(
369 handle: *mut c_void,
370 ) -> usize;
371 pub fn mpsgraph_executable_serialization_descriptor_copy_minimum_deployment_target(
372 handle: *mut c_void,
373 out_bytes: *mut u8,
374 out_len: usize,
375 ) -> bool;
376 pub fn mpsgraph_executable_serialization_descriptor_set_minimum_deployment_target(
377 handle: *mut c_void,
378 value: *const c_char,
379 ) -> bool;
380
381 pub fn mpsgraph_graph_compile_with_descriptor(
382 graph_handle: *mut c_void,
383 device_handle: *mut c_void,
384 feed_tensors: *const *mut c_void,
385 feed_count: usize,
386 flat_shapes: *const usize,
387 shape_lengths: *const usize,
388 data_types: *const u32,
389 target_tensors: *const *mut c_void,
390 target_count: usize,
391 compilation_descriptor_handle: *mut c_void,
392 ) -> *mut c_void;
393
394 pub fn mpsgraph_executable_options(handle: *mut c_void) -> u64;
395 pub fn mpsgraph_executable_set_options(handle: *mut c_void, raw_value: u64) -> bool;
396 pub fn mpsgraph_executable_feed_tensors(handle: *mut c_void) -> *mut c_void;
397 pub fn mpsgraph_executable_target_tensors(handle: *mut c_void) -> *mut c_void;
398 pub fn mpsgraph_executable_specialize(
399 handle: *mut c_void,
400 device_handle: *mut c_void,
401 input_type_handles: *const *mut c_void,
402 input_type_count: usize,
403 compilation_descriptor_handle: *mut c_void,
404 ) -> bool;
405 pub fn mpsgraph_executable_get_output_types(
406 handle: *mut c_void,
407 device_handle: *mut c_void,
408 input_type_handles: *const *mut c_void,
409 input_type_count: usize,
410 compilation_descriptor_handle: *mut c_void,
411 ) -> *mut c_void;
412 pub fn mpsgraph_executable_run_with_descriptor(
413 executable_handle: *mut c_void,
414 command_queue_handle: *mut c_void,
415 input_handles: *const *mut c_void,
416 input_count: usize,
417 result_handles: *const *mut c_void,
418 result_count: usize,
419 execution_descriptor_handle: *mut c_void,
420 ) -> *mut c_void;
421 pub fn mpsgraph_executable_run_async_with_descriptor(
422 executable_handle: *mut c_void,
423 command_queue_handle: *mut c_void,
424 input_handles: *const *mut c_void,
425 input_count: usize,
426 result_handles: *const *mut c_void,
427 result_count: usize,
428 execution_descriptor_handle: *mut c_void,
429 ) -> *mut c_void;
430 pub fn mpsgraph_executable_serialize_package(
431 handle: *mut c_void,
432 path: *const c_char,
433 descriptor_handle: *mut c_void,
434 ) -> bool;
435 pub fn mpsgraph_executable_new_with_package(
436 path: *const c_char,
437 compilation_descriptor_handle: *mut c_void,
438 ) -> *mut c_void;
439
440 pub fn mpsgraph_graph_arithmetic_unary(
441 graph_handle: *mut c_void,
442 op: u32,
443 tensor_handle: *mut c_void,
444 name: *const c_char,
445 ) -> *mut c_void;
446 pub fn mpsgraph_graph_arithmetic_binary(
447 graph_handle: *mut c_void,
448 op: u32,
449 primary_handle: *mut c_void,
450 secondary_handle: *mut c_void,
451 name: *const c_char,
452 ) -> *mut c_void;
453 pub fn mpsgraph_graph_select(
454 graph_handle: *mut c_void,
455 predicate_handle: *mut c_void,
456 true_handle: *mut c_void,
457 false_handle: *mut c_void,
458 name: *const c_char,
459 ) -> *mut c_void;
460 pub fn mpsgraph_graph_relu_gradient(
461 graph_handle: *mut c_void,
462 gradient_handle: *mut c_void,
463 source_handle: *mut c_void,
464 name: *const c_char,
465 ) -> *mut c_void;
466 pub fn mpsgraph_graph_sigmoid_gradient(
467 graph_handle: *mut c_void,
468 gradient_handle: *mut c_void,
469 source_handle: *mut c_void,
470 name: *const c_char,
471 ) -> *mut c_void;
472 pub fn mpsgraph_graph_softmax_gradient(
473 graph_handle: *mut c_void,
474 gradient_handle: *mut c_void,
475 source_handle: *mut c_void,
476 axis: isize,
477 name: *const c_char,
478 ) -> *mut c_void;
479 pub fn mpsgraph_graph_leaky_relu_scalar(
480 graph_handle: *mut c_void,
481 tensor_handle: *mut c_void,
482 alpha: f64,
483 name: *const c_char,
484 ) -> *mut c_void;
485 pub fn mpsgraph_graph_leaky_relu_tensor(
486 graph_handle: *mut c_void,
487 tensor_handle: *mut c_void,
488 alpha_tensor_handle: *mut c_void,
489 name: *const c_char,
490 ) -> *mut c_void;
491 pub fn mpsgraph_graph_leaky_relu_gradient(
492 graph_handle: *mut c_void,
493 gradient_handle: *mut c_void,
494 source_handle: *mut c_void,
495 alpha_tensor_handle: *mut c_void,
496 name: *const c_char,
497 ) -> *mut c_void;
498 pub fn mpsgraph_graph_reduction_axis(
499 graph_handle: *mut c_void,
500 op: u32,
501 tensor_handle: *mut c_void,
502 axis: isize,
503 name: *const c_char,
504 ) -> *mut c_void;
505 pub fn mpsgraph_graph_reduction_axes(
506 graph_handle: *mut c_void,
507 op: u32,
508 tensor_handle: *mut c_void,
509 axes: *const usize,
510 axes_len: usize,
511 name: *const c_char,
512 ) -> *mut c_void;
513 pub fn mpsgraph_graph_concat_pair(
514 graph_handle: *mut c_void,
515 first_handle: *mut c_void,
516 second_handle: *mut c_void,
517 dimension: isize,
518 name: *const c_char,
519 ) -> *mut c_void;
520 pub fn mpsgraph_graph_concat_tensors(
521 graph_handle: *mut c_void,
522 tensor_handles: *const *mut c_void,
523 tensor_count: usize,
524 dimension: isize,
525 interleave: bool,
526 name: *const c_char,
527 ) -> *mut c_void;
528 pub fn mpsgraph_graph_split_sizes(
529 graph_handle: *mut c_void,
530 tensor_handle: *mut c_void,
531 split_sizes: *const usize,
532 split_count: usize,
533 axis: isize,
534 name: *const c_char,
535 ) -> *mut c_void;
536 pub fn mpsgraph_graph_split_sizes_tensor(
537 graph_handle: *mut c_void,
538 tensor_handle: *mut c_void,
539 split_sizes_tensor_handle: *mut c_void,
540 axis: isize,
541 name: *const c_char,
542 ) -> *mut c_void;
543 pub fn mpsgraph_graph_split_num(
544 graph_handle: *mut c_void,
545 tensor_handle: *mut c_void,
546 num_splits: usize,
547 axis: isize,
548 name: *const c_char,
549 ) -> *mut c_void;
550 pub fn mpsgraph_graph_stack(
551 graph_handle: *mut c_void,
552 tensor_handles: *const *mut c_void,
553 tensor_count: usize,
554 axis: isize,
555 name: *const c_char,
556 ) -> *mut c_void;
557 pub fn mpsgraph_graph_pad(
558 graph_handle: *mut c_void,
559 tensor_handle: *mut c_void,
560 padding_mode: isize,
561 left_padding: *const isize,
562 left_padding_len: usize,
563 right_padding: *const isize,
564 right_padding_len: usize,
565 constant_value: f64,
566 name: *const c_char,
567 ) -> *mut c_void;
568 pub fn mpsgraph_graph_top_k(
569 graph_handle: *mut c_void,
570 source_handle: *mut c_void,
571 k: usize,
572 name: *const c_char,
573 ) -> *mut c_void;
574 pub fn mpsgraph_graph_top_k_tensor(
575 graph_handle: *mut c_void,
576 source_handle: *mut c_void,
577 k_tensor_handle: *mut c_void,
578 name: *const c_char,
579 ) -> *mut c_void;
580 pub fn mpsgraph_tensor_array_box_new(handles: *const *mut c_void, count: usize) -> *mut c_void;
581 pub fn mpsgraph_compilation_descriptor_set_callable(
582 handle: *mut c_void,
583 symbol_name: *const c_char,
584 executable_handle: *mut c_void,
585 ) -> bool;
586 pub fn mpsgraph_graph_call_symbol(
587 graph_handle: *mut c_void,
588 symbol_name: *const c_char,
589 input_handles: *const *mut c_void,
590 input_count: usize,
591 output_type_handles: *const *mut c_void,
592 output_type_count: usize,
593 name: *const c_char,
594 ) -> *mut c_void;
595 pub fn mpsgraph_graph_gather_nd(
596 graph_handle: *mut c_void,
597 updates_tensor_handle: *mut c_void,
598 indices_tensor_handle: *mut c_void,
599 batch_dimensions: usize,
600 name: *const c_char,
601 ) -> *mut c_void;
602 pub fn mpsgraph_graph_gather(
603 graph_handle: *mut c_void,
604 updates_tensor_handle: *mut c_void,
605 indices_tensor_handle: *mut c_void,
606 axis: usize,
607 batch_dimensions: usize,
608 name: *const c_char,
609 ) -> *mut c_void;
610 pub fn mpsgraph_graph_gather_along_axis(
611 graph_handle: *mut c_void,
612 axis: isize,
613 updates_tensor_handle: *mut c_void,
614 indices_tensor_handle: *mut c_void,
615 name: *const c_char,
616 ) -> *mut c_void;
617 pub fn mpsgraph_graph_gather_along_axis_tensor(
618 graph_handle: *mut c_void,
619 axis_tensor_handle: *mut c_void,
620 updates_tensor_handle: *mut c_void,
621 indices_tensor_handle: *mut c_void,
622 name: *const c_char,
623 ) -> *mut c_void;
624 pub fn mpsgraph_random_op_descriptor_new(distribution: u64, data_type: u32) -> *mut c_void;
625 pub fn mpsgraph_random_op_descriptor_distribution(handle: *mut c_void) -> u64;
626 pub fn mpsgraph_random_op_descriptor_set_distribution(
627 handle: *mut c_void,
628 raw_value: u64,
629 ) -> bool;
630 pub fn mpsgraph_random_op_descriptor_data_type(handle: *mut c_void) -> u32;
631 pub fn mpsgraph_random_op_descriptor_set_data_type(handle: *mut c_void, raw_value: u32)
632 -> bool;
633 pub fn mpsgraph_random_op_descriptor_min(handle: *mut c_void) -> f32;
634 pub fn mpsgraph_random_op_descriptor_set_min(handle: *mut c_void, value: f32) -> bool;
635 pub fn mpsgraph_random_op_descriptor_max(handle: *mut c_void) -> f32;
636 pub fn mpsgraph_random_op_descriptor_set_max(handle: *mut c_void, value: f32) -> bool;
637 pub fn mpsgraph_random_op_descriptor_min_integer(handle: *mut c_void) -> isize;
638 pub fn mpsgraph_random_op_descriptor_set_min_integer(handle: *mut c_void, value: isize)
639 -> bool;
640 pub fn mpsgraph_random_op_descriptor_max_integer(handle: *mut c_void) -> isize;
641 pub fn mpsgraph_random_op_descriptor_set_max_integer(handle: *mut c_void, value: isize)
642 -> bool;
643 pub fn mpsgraph_random_op_descriptor_mean(handle: *mut c_void) -> f32;
644 pub fn mpsgraph_random_op_descriptor_set_mean(handle: *mut c_void, value: f32) -> bool;
645 pub fn mpsgraph_random_op_descriptor_standard_deviation(handle: *mut c_void) -> f32;
646 pub fn mpsgraph_random_op_descriptor_set_standard_deviation(
647 handle: *mut c_void,
648 value: f32,
649 ) -> bool;
650 pub fn mpsgraph_random_op_descriptor_sampling_method(handle: *mut c_void) -> u64;
651 pub fn mpsgraph_random_op_descriptor_set_sampling_method(
652 handle: *mut c_void,
653 raw_value: u64,
654 ) -> bool;
655 pub fn mpsgraph_graph_random_philox_state_seed(
656 graph_handle: *mut c_void,
657 seed: usize,
658 name: *const c_char,
659 ) -> *mut c_void;
660 pub fn mpsgraph_graph_random_philox_state_counter(
661 graph_handle: *mut c_void,
662 counter_low: usize,
663 counter_high: usize,
664 key: usize,
665 name: *const c_char,
666 ) -> *mut c_void;
667 pub fn mpsgraph_graph_random_tensor(
668 graph_handle: *mut c_void,
669 shape: *const usize,
670 shape_len: usize,
671 descriptor_handle: *mut c_void,
672 name: *const c_char,
673 ) -> *mut c_void;
674 pub fn mpsgraph_graph_random_tensor_shape_tensor(
675 graph_handle: *mut c_void,
676 shape_tensor_handle: *mut c_void,
677 descriptor_handle: *mut c_void,
678 name: *const c_char,
679 ) -> *mut c_void;
680 pub fn mpsgraph_graph_random_tensor_seed(
681 graph_handle: *mut c_void,
682 shape: *const usize,
683 shape_len: usize,
684 descriptor_handle: *mut c_void,
685 seed: usize,
686 name: *const c_char,
687 ) -> *mut c_void;
688 pub fn mpsgraph_graph_random_tensor_shape_tensor_seed(
689 graph_handle: *mut c_void,
690 shape_tensor_handle: *mut c_void,
691 descriptor_handle: *mut c_void,
692 seed: usize,
693 name: *const c_char,
694 ) -> *mut c_void;
695 pub fn mpsgraph_graph_random_tensor_state(
696 graph_handle: *mut c_void,
697 shape: *const usize,
698 shape_len: usize,
699 descriptor_handle: *mut c_void,
700 state_handle: *mut c_void,
701 name: *const c_char,
702 ) -> *mut c_void;
703 pub fn mpsgraph_graph_random_tensor_shape_tensor_state(
704 graph_handle: *mut c_void,
705 shape_tensor_handle: *mut c_void,
706 descriptor_handle: *mut c_void,
707 state_handle: *mut c_void,
708 name: *const c_char,
709 ) -> *mut c_void;
710 pub fn mpsgraph_graph_dropout(
711 graph_handle: *mut c_void,
712 tensor_handle: *mut c_void,
713 rate: f64,
714 name: *const c_char,
715 ) -> *mut c_void;
716 pub fn mpsgraph_graph_dropout_tensor(
717 graph_handle: *mut c_void,
718 tensor_handle: *mut c_void,
719 rate_tensor_handle: *mut c_void,
720 name: *const c_char,
721 ) -> *mut c_void;
722 pub fn mpsgraph_single_gate_rnn_descriptor_new() -> *mut c_void;
723 pub fn mpsgraph_single_gate_rnn_descriptor_reverse(handle: *mut c_void) -> bool;
724 pub fn mpsgraph_single_gate_rnn_descriptor_set_reverse(
725 handle: *mut c_void,
726 value: bool,
727 ) -> bool;
728 pub fn mpsgraph_single_gate_rnn_descriptor_bidirectional(handle: *mut c_void) -> bool;
729 pub fn mpsgraph_single_gate_rnn_descriptor_set_bidirectional(
730 handle: *mut c_void,
731 value: bool,
732 ) -> bool;
733 pub fn mpsgraph_single_gate_rnn_descriptor_training(handle: *mut c_void) -> bool;
734 pub fn mpsgraph_single_gate_rnn_descriptor_set_training(
735 handle: *mut c_void,
736 value: bool,
737 ) -> bool;
738 pub fn mpsgraph_single_gate_rnn_descriptor_activation(handle: *mut c_void) -> usize;
739 pub fn mpsgraph_single_gate_rnn_descriptor_set_activation(
740 handle: *mut c_void,
741 value: usize,
742 ) -> bool;
743 pub fn mpsgraph_lstm_descriptor_new() -> *mut c_void;
744 pub fn mpsgraph_lstm_descriptor_reverse(handle: *mut c_void) -> bool;
745 pub fn mpsgraph_lstm_descriptor_set_reverse(handle: *mut c_void, value: bool) -> bool;
746 pub fn mpsgraph_lstm_descriptor_bidirectional(handle: *mut c_void) -> bool;
747 pub fn mpsgraph_lstm_descriptor_set_bidirectional(handle: *mut c_void, value: bool) -> bool;
748 pub fn mpsgraph_lstm_descriptor_produce_cell(handle: *mut c_void) -> bool;
749 pub fn mpsgraph_lstm_descriptor_set_produce_cell(handle: *mut c_void, value: bool) -> bool;
750 pub fn mpsgraph_lstm_descriptor_training(handle: *mut c_void) -> bool;
751 pub fn mpsgraph_lstm_descriptor_set_training(handle: *mut c_void, value: bool) -> bool;
752 pub fn mpsgraph_lstm_descriptor_forget_gate_last(handle: *mut c_void) -> bool;
753 pub fn mpsgraph_lstm_descriptor_set_forget_gate_last(handle: *mut c_void, value: bool) -> bool;
754 pub fn mpsgraph_lstm_descriptor_input_gate_activation(handle: *mut c_void) -> usize;
755 pub fn mpsgraph_lstm_descriptor_set_input_gate_activation(
756 handle: *mut c_void,
757 value: usize,
758 ) -> bool;
759 pub fn mpsgraph_lstm_descriptor_forget_gate_activation(handle: *mut c_void) -> usize;
760 pub fn mpsgraph_lstm_descriptor_set_forget_gate_activation(
761 handle: *mut c_void,
762 value: usize,
763 ) -> bool;
764 pub fn mpsgraph_lstm_descriptor_cell_gate_activation(handle: *mut c_void) -> usize;
765 pub fn mpsgraph_lstm_descriptor_set_cell_gate_activation(
766 handle: *mut c_void,
767 value: usize,
768 ) -> bool;
769 pub fn mpsgraph_lstm_descriptor_output_gate_activation(handle: *mut c_void) -> usize;
770 pub fn mpsgraph_lstm_descriptor_set_output_gate_activation(
771 handle: *mut c_void,
772 value: usize,
773 ) -> bool;
774 pub fn mpsgraph_lstm_descriptor_activation(handle: *mut c_void) -> usize;
775 pub fn mpsgraph_lstm_descriptor_set_activation(handle: *mut c_void, value: usize) -> bool;
776 pub fn mpsgraph_gru_descriptor_new() -> *mut c_void;
777 pub fn mpsgraph_gru_descriptor_reverse(handle: *mut c_void) -> bool;
778 pub fn mpsgraph_gru_descriptor_set_reverse(handle: *mut c_void, value: bool) -> bool;
779 pub fn mpsgraph_gru_descriptor_bidirectional(handle: *mut c_void) -> bool;
780 pub fn mpsgraph_gru_descriptor_set_bidirectional(handle: *mut c_void, value: bool) -> bool;
781 pub fn mpsgraph_gru_descriptor_training(handle: *mut c_void) -> bool;
782 pub fn mpsgraph_gru_descriptor_set_training(handle: *mut c_void, value: bool) -> bool;
783 pub fn mpsgraph_gru_descriptor_reset_gate_first(handle: *mut c_void) -> bool;
784 pub fn mpsgraph_gru_descriptor_set_reset_gate_first(handle: *mut c_void, value: bool) -> bool;
785 pub fn mpsgraph_gru_descriptor_reset_after(handle: *mut c_void) -> bool;
786 pub fn mpsgraph_gru_descriptor_set_reset_after(handle: *mut c_void, value: bool) -> bool;
787 pub fn mpsgraph_gru_descriptor_flip_z(handle: *mut c_void) -> bool;
788 pub fn mpsgraph_gru_descriptor_set_flip_z(handle: *mut c_void, value: bool) -> bool;
789 pub fn mpsgraph_gru_descriptor_update_gate_activation(handle: *mut c_void) -> usize;
790 pub fn mpsgraph_gru_descriptor_set_update_gate_activation(
791 handle: *mut c_void,
792 value: usize,
793 ) -> bool;
794 pub fn mpsgraph_gru_descriptor_reset_gate_activation(handle: *mut c_void) -> usize;
795 pub fn mpsgraph_gru_descriptor_set_reset_gate_activation(
796 handle: *mut c_void,
797 value: usize,
798 ) -> bool;
799 pub fn mpsgraph_gru_descriptor_output_gate_activation(handle: *mut c_void) -> usize;
800 pub fn mpsgraph_gru_descriptor_set_output_gate_activation(
801 handle: *mut c_void,
802 value: usize,
803 ) -> bool;
804 pub fn mpsgraph_graph_single_gate_rnn(
805 graph_handle: *mut c_void,
806 source_handle: *mut c_void,
807 recurrent_weight_handle: *mut c_void,
808 input_weight_handle: *mut c_void,
809 bias_handle: *mut c_void,
810 init_state_handle: *mut c_void,
811 mask_handle: *mut c_void,
812 descriptor_handle: *mut c_void,
813 name: *const c_char,
814 ) -> *mut c_void;
815 pub fn mpsgraph_graph_lstm(
816 graph_handle: *mut c_void,
817 source_handle: *mut c_void,
818 recurrent_weight_handle: *mut c_void,
819 input_weight_handle: *mut c_void,
820 bias_handle: *mut c_void,
821 init_state_handle: *mut c_void,
822 init_cell_handle: *mut c_void,
823 mask_handle: *mut c_void,
824 peephole_handle: *mut c_void,
825 descriptor_handle: *mut c_void,
826 name: *const c_char,
827 ) -> *mut c_void;
828 pub fn mpsgraph_graph_gru(
829 graph_handle: *mut c_void,
830 source_handle: *mut c_void,
831 recurrent_weight_handle: *mut c_void,
832 input_weight_handle: *mut c_void,
833 bias_handle: *mut c_void,
834 init_state_handle: *mut c_void,
835 mask_handle: *mut c_void,
836 secondary_bias_handle: *mut c_void,
837 descriptor_handle: *mut c_void,
838 name: *const c_char,
839 ) -> *mut c_void;
840 pub fn mpsgraph_graph_control_dependency(
841 graph_handle: *mut c_void,
842 operation_handles: *const *mut c_void,
843 operation_count: usize,
844 dependent_callback: Option<TensorArrayCallback>,
845 dependent_context: *mut c_void,
846 name: *const c_char,
847 ) -> *mut c_void;
848 pub fn mpsgraph_graph_if_then_else(
849 graph_handle: *mut c_void,
850 predicate_handle: *mut c_void,
851 then_callback: Option<TensorArrayCallback>,
852 then_context: *mut c_void,
853 else_callback: Option<TensorArrayCallback>,
854 else_context: *mut c_void,
855 name: *const c_char,
856 ) -> *mut c_void;
857 pub fn mpsgraph_graph_while_loop(
858 graph_handle: *mut c_void,
859 input_handles: *const *mut c_void,
860 input_count: usize,
861 before_callback: Option<WhileBeforeCallback>,
862 before_context: *mut c_void,
863 after_callback: Option<TensorArrayInputCallback>,
864 after_context: *mut c_void,
865 name: *const c_char,
866 ) -> *mut c_void;
867 pub fn mpsgraph_graph_for_loop(
868 graph_handle: *mut c_void,
869 lower_bound_handle: *mut c_void,
870 upper_bound_handle: *mut c_void,
871 step_handle: *mut c_void,
872 argument_handles: *const *mut c_void,
873 argument_count: usize,
874 body_callback: Option<ForBodyCallback>,
875 body_context: *mut c_void,
876 name: *const c_char,
877 ) -> *mut c_void;
878 pub fn mpsgraph_graph_for_loop_iterations(
879 graph_handle: *mut c_void,
880 number_of_iterations_handle: *mut c_void,
881 argument_handles: *const *mut c_void,
882 argument_count: usize,
883 body_callback: Option<ForBodyCallback>,
884 body_context: *mut c_void,
885 name: *const c_char,
886 ) -> *mut c_void;
887}